Directly open basic UI

I just installed openHAB2 on my raspberry it works great! One small issue I have is that I want to make it foolproof. I want to give multiple users access to the basic UI, but I don’t want them to be confused by the UI selection screen. I have a nginx proxy set up to proxy the page from port 8080 to port 80, but I couldn’t proxy directly to the basic ui - if I do this, the CSS and JS breaks and nothing works anymore.

Is it possible to make the Basic UI directly reachable by entering http://<ip_or_hostname>/? I want to skip the UI selection step.

"http://<openhab-ip>:<port>/basicui/app?sitemap=your_sitemap"

don’t work?

1 Like

This would work, but I want to give the users an easier way to access it. Nobody will be able to remember that url (bookmarks aren’t an option because the url will be shared often).

What about some sort of reverse proxy?

I use caddy in docker…and have things like http://openhab.mydomain.com pointing to http://myopenhabmachine.mydomain.com:8080 - you could further extend that to point to http://myopenhabmachine.mydomain.com:8080/basicui/app?sitemap=your_sitemap

All this stuff is behind my firewall and not exposed…I’ve just got a dns record in my router that sends a request to openhab.mydomain.com (or just the hostname openhab) to the machine where my caddy server sits, which happens to be the same one that openhab resides on. And with caddy, you can then get it to work with http and https, and if you’re really keen, get certificates as well.

Might seem a little complicated, but i can explain more if you want. With a proper demo CaddyFile (the config for caddy)

Yes, this is what I did with nginx. But pointing the proxy to /basicui/app will break the references to the JS and CSS because the paths don’t work anymore.

I don’t use basic UI but here’s my nginx config for habpanel. I also modified it for habmin and paperui by changing the server_name line (so habmin.mydomain.local, paperui.mydomain.local, habpanel.mydomain.local all go their respective sites on my openhab box - openhab.mydomain.local just goes to the normal UI selection splash screen). It requires you have some kind of name resolution (DNS server in my case, but host file should work) for all the sites to point to the IP of your openhab box.

# Virtual Host configuration for example.com
# 
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
       listen 80;
       listen [::]:80;

       server_name habpanel.mydomain.local;

       root /var/www/html;

       index index.html index.htm;
       location /rest/ {
                proxy_pass http://openhab.mydomain.local:8080/rest/;
       }
       location /static/ {
                proxy_pass http://openhab.mydomain.local:8080/static/;
       }

       location / {
                proxy_pass http://openhab.mydomain.local:8080/habpanel/;
                proxy_buffering                       off;
                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;
       }
}
1 Like

Unless you don’t reverse proxy and use redirect instead?

I’m in the same case. I try to have something like http://servername/guest redirect to http://servername/habpanel/… but it doesn’t work. There is not all the components of a webpage. I just see some text and button.
I try your solution zolakk and it doesn’t work on my openhab

I don’t think my solution will work for redirecting a subfolder like you want, but it should work just fine as a direct url (http://guest instead of http://servername/guest to use your example), as long as you have a way to resolve ‘guest’ to an IP address (DNS server - some routers offer this or host file on the local machine). Please post your config and maybe we can work it out with you.