Ok, this is a weird one. I’ve got a Pi that has been running Home Assistant in Docker (homeassistant/raspberrypi4-homeassistant:stable) for a while now and it’s always worked fine, up until this week. I had some unrelated network issues because of Pi-hole crashing and once I got that back up and running, my problems with Home Assistant somehow started.
My problem is that I can’t log in anymore, but only when using the externally available domain I have for it. When using the internal hostname and post 8123 it works just fine, so it’s really something reverse proxy related. When I try to log in using the domain name I pointed to it I get the login screen, but after entering my username and password I get a “Unable to connect to Home Assistant.” message with a retry button below it. The URL in the browser at that point is something like https://my.domain.name/lovelace?auth_callback=1&code=base64_data_here. If I look at my browser’s dev toolbar during that request I can see that there is a POST request to https://my.domain.name/auth/token that’s resulting in an error 400, Bad Request.
This is the relevant configuration I have set up in Home Assistant:
http:
server_host: 192.168.1.203
use_x_forwarded_for: true
trusted_proxies:
- 10.0.0.0/24
- 192.168.0.0/16
- 172.17.0.0/16
- 127.0.0.1
base_url: https://my.domain.name
Up until the point the issue started I was only using the base_url
part, I added the rest in to try and resolve the issue, without any luck sadly.
Just in case it’s relevant (though I don’t think it is), I’m also using emulated_hue
so my Logitech Harmony can control my non-Hue lamps:
emulated_hue:
listen_port: 80
advertise_ip: 192.168.1.203
Relevant netstat output:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.1.203:80 0.0.0.0:* LISTEN -
tcp 0 0 192.168.1.203:8123 0.0.0.0:* LISTEN -
Just to reiterate, nothing seems to be wrong with Home Assistant itself. All my automations are working, all relevant ports are open and even the web UI is working, just not externally. Can any of you see something that I’m missing here?