- Platform information:
- Hardware: aarch64/4GB/64GB
- OS: Manjaro
- Java Runtime Environment: java 11
- openHAB version: 3.0
- Issue of the topic: Run openhab in a subdirectory in nginx reverse proxy
- Please post configurations (if applicable):
- Items configuration related to the issue: none
- Sitemap configuration related to the issue: none
- Rules code related to the issue: none
- Services configuration related to the issue: none
- If logs where generated please post these here using code fences: none
Hi,
Did someone manage to run openhab 3.0 in a subfolder in nginx reverse proxy mode?
I’d like to run in http://myserver/smarthome, ideally it should be as easy as configuring nginx as:
location /smarthome {
return 301 $scheme://$host/smarthome/;
}
location /smarthome/ {
proxy_pass http://localhost:8080/;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
However this is not working. If I navigate to http://myserver/smarthome i can only see a blank page. Network pane shows the following:
I remember having a slightly different configuration for BasicUI in OH2, which works a little better, but still unusable:
location /smarthome {
return 301 $scheme://$host/smarthome/;
}
location /smarthome/ {
proxy_pass http://localhost:8080/;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
sub_filter_types application/javascript text/xml text/css text/javascript application/json text/plain;
sub_filter_once off;
sub_filter '/rest/' '/smarthome/rest/';
sub_filter '"/icon/' '"/smarthome/icon/';
sub_filter '"/basicui/' '"/smarthome/basicui/';
}
The result is this, all requests complete with HTTP status 200, but it doesn’t work yet:
Any idea on how to fix this?