OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: rudiratlos63 on February 25, 2024, 04:05:34 pm

Title: Homeassistant behind nginx proxy not working
Post by: rudiratlos63 on February 25, 2024, 04:05:34 pm
Hi, I try to run Homeassistant (running on port 8123) behind the nginx plugin.
in homeassistant configuration.yaml in section http: I have the entries use_x_forwarded_for: true and trusted_proxies: <lan address of opnsense>

in nginx logs http access, I get error status codes 304 400 499

according to
https://community.home-assistant.io/t/reverse-proxy-using-nginx/196954

there are headers needed like:
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;

but I can not get it to run.

Is there a way to set the headers via the opnsense web gui?
Title: Re: Homeassistant behind nginx proxy not working
Post by: Fright on February 25, 2024, 08:27:14 pm
Hi
Quote
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
'WebSocket support' in Location settings with advanced mode on

Quote
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
it is the default value
if you need to add a port (I think I saw such a requirement somewhere for homeassistant) - it's in Upstream advanced mode settings