Guys, just for info. There is all information in this thread to make it work. My problem was that the response time was very slow if I go via my domain and reverse proxy. But the problem was in my ASUS RT-AX56U router. I do all port forwarding and everything worked, except for slow loading time.
In the end, I have to disable DoS protection in the Asus router. I can’t tweak it but just disable it. And now it works.
I will put all words for google, hopefully someone will find my post: slow loading time nginx home assistant reverse proxy
Ah right, I am trying to get it working with a VM running on my unraid server (so would think pointing it to the IP would work the same as yours does). But just cannot get it to work. Cloudflare or the Port Forward may be the issue. Just cannot figure it out
Ah cool, cheers. Any chance you are using cloudflare? I am struggling with this info from the top of the swag proxy config for HA.
## Version 2021/10/11
# make sure that your dns has a cname set for homeassistant and that your homeassistant container is not using a base url
# As of homeassistant 2021.7.0, it is now required to define the network range your proxy resides in, this is done in Homeassitants configuration.yaml
And my cloudflare config - I would have thought the CNAME and A record that SWAG uses for the rest of my docker containers would suffice?
I make a specific CNAME for every container I proxy through swag.
So I have one called homeassistant pointing to @ which is the A record. But if yours is already working with other containers I suppose it’s fine.
If you have them in separate containers, they’re separate boats. It also gives you a little more flexibility. And, you don’t have to restart Home Assistant whenever the cert renews.
I went for option 3 and installed Nginx in a VM on a completely different host. All is good now!
Original post
In my case HA is still blocking the proxy IP address. I already checked the documentation and compared to my configuration a dozen times, but can’t figure out what is wrong. I hope a couple of extra pair of eyes can help.
Server architecture:
Server running docker with IP 192.168.0.8
HA runs in docker, using host as network_mode.
Nginx Proxy Manager runs in docker. No network_mode specified.
Nginx Proxy Manager configuration:
Forward to 192.168.0.8 on port 8123.
Ticked ‘Block Common Exploits’
Ticked ‘Websockets support’
Ticked ‘Force SSL’
Ticked ‘HTTP/2 support’
Nothing in ‘Custom locations’ and ‘Advanced’ tab
The proxy as such works, because I can use my own domain to reach HA. On the internal network, I’m also using the public domain.
Digging into the raw Nginx Proxy Manager config files:
server {
set $forward_scheme http;
set $server "192.168.0.8";
set $port 8123;
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name my.custom.domain;
# Let's Encrypt SSL
include conf.d/include/letsencrypt-acme-challenge.conf;
include conf.d/include/ssl-ciphers.conf;
ssl_certificate /etc/letsencrypt/live/npm-3/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/npm-3/privkey.pem;
# Block Exploits
include conf.d/include/block-exploits.conf;
# Force SSL
include conf.d/include/force-ssl.conf;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
access_log /data/logs/proxy-host-4_access.log proxy;
error_log /data/logs/proxy-host-4_error.log warn;
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
# Proxy!
include conf.d/include/proxy.conf;
}
# Custom
include /data/nginx/custom/server_proxy[.]conf;
}
I’m hoping to run HA on a separate VM from the VM that’s hosting my Swag-letsencrypt(nginx) container (because I’m looking for the full HASS OS experience and I dont think I can get that via docker image?) I’ve looked at some solutions for configuring nginx but nothing seems to be working. I’m getting either a 502 or a 400 error when I hit my subdomain address.
Thank you, thank you, thank you. Spent like 2h or so today by trying different guides and always something did not work. This is the only guide that I got working with HA. All the lines under “location” are not mentioned in standard guides at all. Thanks a lot!