Home assistant (400 Bad Request) Docker + Proxy - Solution

f*ck yes… 3 days of trying to resolve this, having the similar configuration with Synology reverse proxy…
Finally working.

1 Like

This breaking change may of lead to a few divorces/breakups.

1 Like

Thank you!!!

1 Like

Awesome post. I’ve spent days trying to figure out why Home Assistant was the only service that didn’t work with my new traefik reverse proxy…



Would you be able to help explain how to implement this solution?

Very much appreciated!

1 Like

Here is an unusual case that might come up for a few. I set up an HA box in my home network. THen moved it to another network where I use an openvpn tunnel to access it, but the reverse proxy is still on my network. So guess what…what HA thinks is the reverse proxy is actually is the IP of the other end of the tunnel. I guess that’s not surprising but I had to go to the logs like the OP to see the IP and then quickly realized it was the tunnel IP. THere you have it!

Which part? It solves an issue where HA is being a proxy . So make sure that is your setup.

The fix has 3 steps

  1. Check configuration->basic->log for reverse proxy error. Note the IP address in the error message. if you don’t have it, then you have a different problem.
  2. Edit the configuration.yaml file
  use_x_forwarded_for: true
    - XXX.XXX.XXX.XXX # Add the IP address of the proxy server

  1. Restart your Home Assistant server.

The problem should be resolved.

I’ve had problems with HA behind cloudflare’s proxy , and I had to turn it off for external access to the server to work. I reconfigured my proxy setup over the weekend, and HA was the last server I had to get working behind cloudflare’s proxy.

I’m done! I can enjoy the last few hours of my weekend now, lol. This thread saved those last few hours so thanks!


Thanks @kiwijunglist for this post. I had a different issue, but pointed me into the right direction to solve it.
I am running HASS Supervised on a pi behind a traefik reverseproxy in a docker on a synology NAS. This NAS has two ethernet ports.
I configured only one of them in HASS which worked for months. But suddenly I got the 400.
Adding the 2nd IP Address in the http section solved it.

1 Like

Thanks. It worked. It took some time to figure out what IP should I provide in my case. And worked for me.

1 Like

This solved my issue of using reverse proxy to HA.


Thank you very much, man. It works.
The problem was breaking my head.

1 Like

Just created an account to say “Thank you”. Was chasing my tail for the last 2 days with this.

1 Like

you’re welcome!

Just came here to bump this thread. Went from HA Docker + SWAG Docker install to Hass OS so had to repoint DNS internally etc. It was this http: config in configration.yaml that was the issue.

Went from 1 hr of troubleshooting to 15 minutes. Thanks all!

This helped me too :+1:

Thank you!!!

Not sure why would not be allowed by default but here we are. Thank you for posting the solution.

1 Like

[spanish] (aunque lo hablo muy mal, lo siento)
te agradezco muchissimo!

Me ayudo tambien eso (fuente : Accessing HASS.io through Apache, error "Unable to Connect to Home Assistant, Retry" - #5 by aktivalux)

In case anyone else is having this issue, the following fixed it for me.

sudo a2enmod proxy_wstunnel
sudo systemctl restart apache2

Mil gracias!

So far this solution worked for me.
I reconfigured my docker.
So I recreated the docker of my HA, and I reused the same file space to keep my HA.

With HA local ip it works.
On the other hand, for public access, I use a Duckdns domain name which points to my reverse Nginx proxy in a docker. My Nginx’s docker has a bridge network while my HA’s has a host.

I have good in my configuration.yaml
http: use_x_forwarded_for: true trusted_proxies: -

Dans les logs de HA, j’ai 2023-01-10 10:06:05.518 ERROR (MainThread) [homeassistant.components.http.forwarded] Received X-Forwarded-For header from an untrusted proxy

I’m using the same configuration of my Nginx as before.
If you have different solutions.

Great, you have solved my problems. Thank you very much.