I have been getting 502 bad gateway errors with nginx.My config looks right to me.I am running HASS OS in a hyper-v vm.Here is my config file:
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
http:
use_x_forwarded_for: true
trusted_proxies:
- 192.168.1.44
I run nginx in a docker container on a raspberry pi which is on a different machine than my vm.In the nginx error log it says
2024/01/26 00:55:38 [error] 461#461: *7221 homeassistant.local could not be resolved (2: Server failure), client: 192.168.1.154, server: homeassistl.duckdns.org, request: "GET / HTTP/2.0", host: "homeassistl.sistl.duckdns.org", referrer: "http://192.168.1.44:81/"
I know I have IP addresses here, but I do not expose any ports. I can not ping/curl -v from my raspberry pi, but can from other computer.If you need any config or logs please tell me.
That DNS name relies on having you VM in “bridge” mode, i.e. allowing broadcasts to your LAN network (192.168.255?).
Try with the IP address of the VM host (assuming proper port forwarding is in place there to HAOS)
Also, I am running ubuntu on my raspberry pi. I might have been typing the name wrong before, but I can now access homeassistant.local:8123 from my raspberry pi.I changed the VM network to bridge mode but it did not do anything. I use duckdns for my domain and it points to the ip of the proxy
Ah, well, it’s basically the same issue but at the other end: unless your docker container (the nginx one) runs in host networking mode, it doesn’t have access the “mDns” (the “.local” dns space) either.
Bottom line, to avoid headaches, don’t use mDNS on non-simple setups (VM’s, docker, …)
I figured it out. You need to install mariadb, (maybe not, I don’t know yet) nginx proxy manager (NOT the ssl proxy). To get Ngnix you need to enable advanced mode in user settings. The default credentials for nginx are: [email protected], and the password is changeme. you then need to set up your info, after that set up a proxy host with your domain name, ip of home assistant os for the hostname/ip, and port 8123 with websockets support. after you set that up visit you domain and if you get 400: bad request, use a file browser of your choice, and check the home assistant log for something like this:
2024-01-28 09:32:19.013 ERROR (MainThread) [homeassistant.components.http.forwarded] Received X-Forwarded-For header from an untrusted proxy 172.30.33.2
get the ip and remember it in configuration.yaml put this in:
http:
use_x_forwarded_for: true
trusted_proxies:
- home assistant machine ip
- ip from log
then reboot home assistant and when you visit your domain you should be greeted with the log in screen.
I have the same problem, can’t access HA through my ngnix proxy manager.
HA is running on a VM (192.168.22.88) on my TrueNAS (192.168.22.55).
The ngnix is running as a kubernetes-app on the TrueNAS with the same
IP as the TrueNAS, just on his own port.
In the configuration.yaml of HA I put
http:
use_x_forwarded_for: true
trusted_proxies:
- 192.168.22.55
- Kubernetes cluster DNS IP -> 172.17.0.10
Can’t get my HA over https://ha.mydomain.de
cname is set, same setup works for nextcloud paperless and immich.