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

Thanks a lot ! The nginx proxy documentation should be improved with your text.

You saved my evening.

(homeassistant os version 2021.10.02)

1 Like

Also a big thanks for me. It solved the issue. Using Home assistent core-2021.10.4.

1 Like

You guys have no idea the amount of time I’ve spent trying to figure this out. This is exactly what I needed. I was checking the logs in the NPM addon, but it wasn’t very clear. I thought I might get a clue with developer tools in Chrome. Nothing helped until I read this post. Thank you @kiwijunglist for posting this. You have probably helped save my marriage LOL through this.

1 Like

I can relate to that

Thank you! This helped a great deal!

1 Like

Enable TLS 1.2?

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…

Thanks!

2 Likes

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
http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 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!

4 Likes

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 127.0.0.1 worked for me.

1 Like

This solved my issue of using reverse proxy to HA.

2 Likes

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

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!