Home Assistant is starting its own webserver. What you want to do is proxy it from another server like nginx, Apache or Træfik for example. And that’s on this webserver you will choose to map /test/homeassistant/ to http://localhost:8123 (probably).
Great suggestion. Unfortunately it does not work. Please try it.
Actual behavior:
/test/homeassistant/ 200 OK
/static/favicon-192x192.png 404 Not Found
/static/core-…js 404 Not Found
/static/webcomponents-lite.min.js 404 Not Found
It’s not written in such a way that proxy functionality will work. It looks hardcoded to use the root directory, which is not the best practice for creating a web server. I’m sure that there are tons of individuals who implement workarounds rather than relying on this basic functionality.
Oh well, you’re right (I didn’t try as I use hass on a subdomain). So there is an issue here: all the assets are loaded with a / in front of their path, which is obviously causing problems when hass is expected to be in a sub-folder. You should probably open an issue on GitHub.
I’m not using Apache so I didn’t try this setup exactly, but the (light) tries I made with Træfik exposed an issue: some requests made by hass are directly referring to /static/whatever. It seems the leading / is causing issues when you host hass in a (virtual) subdirectoy via any kind of proxy.
Notice that there is no “/” after the proxy destination. Here is the request behavior under this config:
/hass/homeassistant/ 200 OK
/static/core-…js 200 OK
/static/webcomponents-lite.min.js 200 OK
/static/mdi-…html 404 not found
/static/frontend-…html 200 OK
/static/favicon-192x192.png 200 OK
/api/websocket/ 404 not found
The last 404 just keeps repeating. Setting:
proxy_buffering off;
In my Nginx config simply makes the websocket requests get dropped faster.
Hope this provides some insight. I’ll let you know if I figure out how to pass the websocket requests through Nginx.
A bit strange it is not possible for such a modern project.
I do not have a domain, I remotely connect to my server via IP and I would want to have access through Apache reverse proxy in a sub-directory!
That feature would be awesome…
Thanks