I run OpenHAB2 on a Raspberry Pi and use Webview to view charts created by Grafana on the same machine.
This works fine locally, i.e., if accessed with ip-address http://192.168.1.16:8080, but does not work via https://192.168.1.16:8443, since the Webview elements point to static pages that try to load the Grafana charts over plain http … so Firefox blocks them with the following error:
Blocked loading mixed active content "http://192.168.1.16:8080/static/chartsTempOutsideDay.html" Note that using 8443 would not help, since the static pages still contain the http link to Grafana … however, this is not what I am writing about, but it helps understanding my problem.
Now, to access the OH from the internet, I run nginx reverse proxy on 192.168.1.6, that passes traffic to https://openhab.mysite.com to http://192.168.1.16:8080.
This way, I can access the OH, but the charts won’t load. First, I got the the same error as above, but even when I allowed loading of mixed content, the charts do not work. It looks like the local addresses do not get translated, so Firefox is trying to load content from 192.168.1.16 … while accessing the site from the internet.
I have seen in other threads that the setup with nginx should work, but they have it on the same machine as OpenHAB … is this the problem? And if so, what should I do? Is there some way to adjust the nginx setup on the other server, or should I install an nginx instance on the Raspberry pi as well and forward from one nginx to the other? (I am new to all this reverse-proxy thing.)
Note: I have also access to Grafana via https://grafana.mysite.com, with authentication by nginx (since OpenHAB requires grafana with anonymous access on the LAN). This means that I could change the links to Grafana to use the internet address, but that would mean removing the authentication … and I do not want all my charts open on the internet…