Proxying OTGW web server - absolute URLs
Posted: Sun Mar 01, 2015 12:18 pm
I'm playing a bit with otmonitor (4.2.1) running as a daemon on my Raspberry Pi. I like the web interface a lot, it also appears to be more stable than access OTGW values from within Domoticz (lock ups).
Since I use Nginx already to access Domoticz (because I want HTTPS access, which was not available until recently in native Domotic) I decided to use it as a front-end for the OTGW web server as well.
I proxy the location '/otgw/' to the local port on which OTGW is listening, like so:
This works - sort of: I get the main page with the status overview, but stylesheets, images and links to for example the graph are not working because they are absolute to the webroot. This means that: '/status.html' does not get proxied to '/otgw/status.html' ( which would work), but to '/status.html', which does not exist.
Would it be possible to either replace the absolute URLs with relative URLs, or to replace them with the complete URL (i.e. including host name) so that there's a pattern in the URL that I can rewrite with Nginx directives?
Edit: should have been posted in OTGW subforum - sorry.
Since I use Nginx already to access Domoticz (because I want HTTPS access, which was not available until recently in native Domotic) I decided to use it as a front-end for the OTGW web server as well.
I proxy the location '/otgw/' to the local port on which OTGW is listening, like so:
Code: Select all
location /otgw/ {
proxy_pass http://localhost:8081/;
proxy_redirect default;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Would it be possible to either replace the absolute URLs with relative URLs, or to replace them with the complete URL (i.e. including host name) so that there's a pattern in the URL that I can rewrite with Nginx directives?
Edit: should have been posted in OTGW subforum - sorry.