UI: Adding custom PHP-content

Post Reply
Posts: 653
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland

UI: Adding custom PHP-content

Post by Nautilus » Monday 06 February 2017 10:45


I was wondering if there are any good ways to serve php pages under the "custom" (~/domoticz/www/templates) section without exposing anything additional to public network? It naturally works fine from an iframe as long as you are in the local network and fetch the iframe from the address where php enabled web server is installed.

I stumbled upon this:
https://www.domoticz.com/wiki/Secure_Ng ... _Templates
If you want to use Domoticz Custom Templates and embed another device into an iFrame you will need to proxy that also. For security reasons modern browsers will not allow scripts/code to execute from an external site via an iFrame. Since we have the proxy already running we can simply proxy anything we also want to run in an iFrame so it loads from the same site as Domoticz.
In the configuration provided above is an example for setting up a proxy for an IPCamera View, modify it for your needs and copy/paste it as many times as you need. Then restart Nginx and test your proxy manually by visiting the path you specified.
If your page displayed correctly go to your Domoticz install, browse to domoticz/www/templates/ path create a file such as cam1.htmlusing this example:
Should this kind of setup work for the above described purpose when Nginx is installed with php support? Any other options?

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests