I use HomeAssistant on a machine that ‘lives’ behind an Nginux reverse proxy that handles SSL offloadning. see: Nginx automatic SSl ofloading proxy
My external domain points to the reverse proxy that is running on another machine than the HA docker runs on. So I have
machine 1:
- is connected to my domain name
- runs docker SSL offloading proxy with lets encrypt
- runs a custom nginx proxy in docker to reroute traffic to machine 2:
Machine 2:
- runs Home Assistant on docker
Home assist works fine if I connect directly on the local IP 10.0.0.15:8123, I have configured a password, su I have to login an that works fine.
If I try to connect from the outside world on my domain I also get the very same login screen and see that my SSL and routing works.
However, I will not be able to login…
I tried to peek what is happening and noticed that a websocket is tried and my firefox console says 'Firefox can not connect to wss://homeAssist.mydomain.com/api/websocket
So it seems nginx proxy cannot make the switch to sebsocket?
Here is how I start the proxy on server 1:
docker run --name home.dwii -p 8123:80 -d --restart=always
-v /etc/nginx/apps/homeAssistant:/etc/nginx/conf.d
-e VIRTUAL_HOST=<my home assist url .>
-e LETSENCRYPT_HOST=<my home assist url .>
-e LETSENCRYPT_EMAIL=<my domain email .>
This will then cause the docker nginx config generator to generate and start the SSL configuration.
/etc/nginx/conf.d will look like:
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
server {
server_name <my home assist url .>;
listen 80 ;
location / {
proxy_pass http://10.0.0.15:8123;
}
}