@francisp 3 years later, you’re still saving lives. Thanks!
Thank you, that was the solution for me too.
Absolute hero!
Thank you for this.
My setup is interesting in that I have Home Assistant OS running as a virsh/QEMU container, and Swag running in docker on the same physical hardware. Swag has a sample reverse proxy configuration for homeassistant already that mostly worked, except for the 400 error I was encountering on the HA side.
Sure enough, the logs said that HTTP integration was not set-up for reverse proxies. Adding in the trusted proxy IP address in to the configuration and restarting Home Assistant did the trick.
This has allowed my local voice assistant to work
I was running into this as well when setting HomeAssistant up using NGINX Proxy Manager. Based on what’s stated in this thread you have to enable websockets for it to work right. Go into the host settings and turn the websockets option on and you’re good to go.
thanks, it’s really helpful!
Thank You!!
Hello please i really need help.
I did everything thing and still have the same problem
Today something strange happened to me.
I use the Nginx Proxy Manager for my reverse proxy. I host it in HA as a HA addon. In my configuration.yaml I have added the lines in the op with an IP similar to 172.30.33.4.
But, this morning the connection didn’t work through the proxy domain.
I had to recheck the IP via the log and update it in configuration.yaml. Does this make sense? That the IP changes being hosted in the same machine?
In the meanwhile, I tried to use 127.0.0.1 as the IP and didn’t work.
Today again, at 1AM, the IP from the Nginx Proxy Manager HA addon has changed from 172.30.33.4 to 172.30.33.5. Seeing this pattern, i have changed the trusted_proxies entry to 172.30.33.0.
I had the same issue and thanks for hint! If you go to developer mode of your browser there was error on network related to WebSocket (wss protocol).
I set in Nginx:
Websockets Support
and it works!
Thanks a lot!!!
it works, but if I restart my docker, the IP is changing. Any suggestions?
@hsch0 this is the working configuration for today:
# Cloudflare setting to unlock reverse proxy
http:
use_x_forwarded_for: true
trusted proxies:
- 172.30.33.0/24
- 103.21.244.0/22
- 103.22.200.0/22
- 103.31.4.0/22
- 104.16.0.0/13
- 104.24.0.0/14
- 108.162.192.0/18
- 131.0.72.0/22
- 141.101.64.0/18
- 162.158.0.0/15
- 172.64.0.0/13
- 173.245.48.0/20
- 188.114.96.0/20
- 190.93.240.0/20
- 197.234.240.0/22
- 198.41.128.0/17
Define a network for your reverse proxy so that you know what subnet you should set in HA’s config.
In your reverse proxy’s docker compose add a network with an IP range. It can be a range you choose, just make sure it’s within the local addresses for IPv4:
services:
reverse-proxy:
# Your existing proxy defined here.
networks:
- local-proxy-network
networks:
local-proxy-network:
ipam:
config:
- subnet: 172.19.0.0/24
In Home Assistant, set the same IP range as above.
http:
use_x_forwarded_for: true
trusted_proxies:
- 172.19.0.0/24
You might have to stop your proxy instance, not just restart it to get this new network setting applied. You can of course add other docker containers to this network if you wish.
Thanks for your tip with the websockets. 3 1/2 years later it still helps .
Legend. This solved my issue. Thank you!
Hi guys, I have a strage problem using duckdns/nginx.
So let me recap:
- Create myname.duckdns.org
- Setup Nginx as follow:
http:
use_x_forwarded_for: true
trusted_proxies:
- XXX.XXX.XXX.X/XX
- I open port forwarding for myname.duckdns.org:8123 to port 80
- I open port forwarding for myname.duckdns.org:4445 to port 443
The issue I have:
-
When i try to connect locally to HA with http://homeassistant.local:8123 everything works fine
-
When I try to connect remotely with myname.duckdns.org:8123 I can access to HA
-
When I try to connect remotely with myname.duckdns.org:4445 the browser show me 502 error Bad Gateway | Nginx
How is it possible that remotely I can assess to 8123 and not to 4445??
I can’t figure out what’s happening…If someone has more knowledge to share please you are welcome
Shoud I turn on CloudShare in Nginx configuration menu? I don’t know what it is
I’m using MariaDB but I don’t set anything more in Nginx config
Gracias por tu ayuda me fue de mucha utilidad.
The solution didn’t work for me, until I ticked Websockets support in the nginx proxy manager and https/2 too, although I have no idea why. Until I did that it just said it couldn’t reach it - even though I got the branded page from the server. Now it works fine, thanks.
Just FYI - you can add the entire docker bridge range, just in case it ever changes, eg:
172.18.0.0/16
Hey everyone, I read through all the threads and tried everything, but still no luck…
I recently followed this video by https://www.youtube.com/watch?v=n1vOfdz5Nm8 with a high degree of success (the only difference was using Adguard instead of Pihole), so in summary, I have:
- Proxmox;
- Home assistant OS running in its own container;
- Traefik as a reverse proxy serving certificates in a docker container inside an Ubuntu LXC.
I can access Home assistant trough the nabu casa remote URL and trough the local IP.
When I try to access it through the https URL I setup with traefik I get the correct certificate but an “Internal Server error message”
After some debugging I can see this message in the Home assistant logs:
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 350, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
Invalid method encountered:
b'\x16\x03\x01'
^
My configuration.yaml has this:
http:
use_x_forwarded_for: true
trusted_proxies:
- 192.168.0.0/16
- 10.0.0.0/8
- 172.16.0.0/12
Any ideas?