In good news I have successfully set up the nginx reverse proxy using the openhabian-config tool with a simple setup (no SSH, no passwords) because I only want to access it from my local area network.
I want people on the home network to be able to type “rpi.local” and go straight to "rpi.local:8080/habpanel/index.html#/ and it mostly works except it always takes me to the “Welcome to HABPanel! Click or tap here to begin” and I have to manually go into settings and switch from “Local storage” to “Panel configuration”.
Is there any way to configure the reverse proxy so that it takes me straight to the habpanel home page every time?
Most of the configuration below is default.
#################################
# openHABian NGINX Confiuration #
#################################
## Redirection
#server {
# listen 80;
# server_name localhost;
# return 301 https://$server_name$request_uri;
#}
## Reverse Proxy to openHAB
server {
listen 80;
# listen 443 ssl;
server_name localhost;
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
# Cross-Origin Resource Sharing.
# add_header 'Access-Control-Allow-Origin' 'http://localhost:8080/rest';
add_header 'Access-Control-Allow_Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
## Secure Certificate Locations
# ssl_certificate CERTPATH;
# ssl_certificate_key KEYPATH;
location / {
proxy_pass http://localhost:8080/habpanel/;
# proxy_buffering off; # openHAB supports non-buffering specifically for SSEs now
proxy_set_header Host $http_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;
## Password Protection
# auth_basic "Username and Password Required";
# auth_basic_user_file /etc/nginx/.htpasswd;
}
location /rest/ {
proxy_pass http://localhost:8080/rest/;
}
location /icon/ {
proxy_pass http://localhost:8080/icon/;
}
location /chart/ {
proxy_pass http://localhost:8080/chart/;
}
location /static/ {
proxy_pass http://localhost:8080/static/;
}
## Let's Encrypt webroot location
# location /.well-known/acme-challenge/ {
# root /var/www/localhost;
# }
}
# vim: filetype=conf