I have scoured the forums here as well as Reddit and Unraid, seen lots of people with similar/exactly the same issue I’m having. Most of the posts end with the OP getting a fix and I try the same things and NOTHING will work. All I ever get is “502 Bad Gateway”.
I’m running HA in an Unraid docker container with it’s own IP, I also have an Nginx Proxy Manager docker running. In my router I’m forwarding port 443-1443 on Nginx and 80 - 180 on Nginx. I have over a dozen other proxies set up and they all work absolutely fine, I really feel like the proxy set up for HA is needlessly complicated especially considering how many posts I’ve seen with similar issues. I get that it’s more secure the way it is now but it seems fkn impossible for me to set up.
I can connect to HA no problem locally with HOME ASSISTANT IP:8123, I can also connect through ‘MY DUCKDNS SUBDOMAIN:8123’ if I forward 8123 to HA in my router but I cannot connect through my own subdomain which is going down the exact same route. I have a c-name routing ‘home.MY DOMAIN’ straight to ‘MY DUCKDNS SUBDOMAIN’, in theory I should be able to go to ‘home.MY DOMAIN:8123’ no problem.
I have tried adding anything in my network that is along the route to the Trusted Proxies: section in the configuration.yaml, and tried changing the order of them. I got excited when I saw someone post to use 0.0.0.0/0 to whitelist all proxies but that doesn’t seem to work either. In Nginx I have Websocket support on, and tried every conbination of the other settings (force ssl, etc.), I don’t think it’s a problem with Nginx.
I can see the following error in the Nginx error log:
2022/01/18 13:15:26 [error] 21834#21834: *828767 connect() failed (113: Host is unreachable) while connecting to upstream, client: xx.xx.xx.xx (my ip), server: MY DOMAIN, request: “GET /lovelace HTTP/2.0”, upstream: “HOME ASSISTANT IP/lovelace”, host: “MY DOMAIN”
ps. apparently new users can only have 2 urls in a post for some stupid reason which is why all the “urls” are just me typing in caps because I’m so frustrated at this point.
UPDATE Jan-19
I’ve made some progress; I had the thought to try pinging my Unraid Server from the nginx docker container and discovered that it couldn’t get replies at all but only from my Unraid Server, I could ping everything else on the network just fine. I looked in to this and found that it’s a security feature for docker stuff and just had to turn it off in the Unraid docker settings.
I can now connect to HA and see my login screen with my domain through proxy, but alas, as soon as I enter my credentials all I get is and error with the HA Icon saying “Unable to connect to Home Assistant.”
I can see this in the Firefox Console:
“Firefox can’t establish a connection to the server at wss://home.MYDOMAIN/api/websocket.”
I’ve got Websocket support enabled in nginx so I still don’t know what the problem is.