I’m trying to use nginx as reverse proxy to provide security and encryption for openhab2. Most seems to work, but the API call for “/rest/sitemaps” always return content with http:// - even though “X-Forwarded-Scheme: https” is in the request.
X-Forwarded-Proto seemed to do the trick Already disabled buffering. That’s very obvious for events to be returned to client instantly.
However, tried using habmin with http basic auth on the reverse proxy with Chrome? It seems to mess up auth for some ajax requests. Authorization header sent is suddenly blank. Safari seems to work ok. I just wanted to be sure it’s not only on my installation.
For my setup I wanted more control over authentication than openHAB provides natively (at least in 1.x) so I have nginx do the authentication. That’s why nginx sends a blank Authorization header to openHAB (which I believe actually deletes it from the request sent to openHAB). If you want to have nginx pass through the Authorization header that the client sends, remove the “proxy_set_header Authorization” line from the config. It’s also possible to have nginx send a different Authorization header (with a different username/password) to openHAB.
I too have the problem with Nginx reverse proxy with Auth and Habmin on Chrome. However BasicUI and PaperUI work without problem on Chrome. On Safari Habmin also works without problem.
I also got issues with nginx, but only on my LG G5.
It is working without any issues in a browser and in Habdroid on my samsung tablet.
On the LG G5 I have to disable the ssl check (ignore ssl hostname) but on the Samsung device I don’t have to disable anything.
Are there any subdirectories that could cause the issue?
Something like smarthome/rest/items
But I checked the known directories.
@Benjy have you found anything on this yet? It’s still happening with build 657 from a few days ago, both through my local nginx reverse proxy as well as through the new myopenhab cloud service.
Hi @jcollie, yes unfortunately I came to a point in HABmin’s implementation as you have seen but am not savvy with that code to be of any use at the moment.
Yeah, the code probably never took into consideration that the virtual origin for the site would be anything but that of the Jetty server, not to mention that the scheme might change (https vs http).
I have a reverse proxy running to Openhab2, the html comes through fine but the CSS and Graphics don’t. The graphics are showing errors “file not found”.
*************NOTE: /usr/share/nginx/html is located on the Host, not the Server.
2017/04/28 16:06:55 [error] 18505#0: *1145 open() “/usr/share/nginx/html/icon/switch” failed (2: No such file or directory), client: 10.10.231.107, server: 10.10.231.242, request: “GET /icon/switch?state=home&format=svg HTTP/1.1”, host: “10.10.231.241”, referrer: “http://10.10.231.241/openhab/”
I am configured as shown by JCOLLIE earlier in this thread
I am running two RPi, one with Openhab2 (http and Openhabian) and one with NGINX (https and Raspian).
The location “/” with a local root setting runs fine.