Cybnew Posted September 1, 2021 Share Posted September 1, 2021 I've recently transitioned from running Homeassistant on a raspberry pi, to running it through a VM on my Unraid box. I'm trying to get the routing correct through SWAG. SWAG is setup through a custom proxynet network type (I think I followed spaceinvader1's video?) When I had it set up on the pi, I could access my home assistant instance through the reverse proxy at homeassistant.mycustomurl.com. Now, with the VM I'm getting a "400 Bad Request" error when I try to access through the reverse proxy. I've got the VM Ip reserved in my router (192.168.86.66) and can access Home Assistant through that IP address through the browser from a laptop on the network. My SWAG config file for home assistant is the same as when it worked on the raspberry pi, the only difference is the change from the ip address of 192.168.86.54 to 192.168.86.66 for the new VM. ## Version 2020/12/09 # make sure that your dns has a cname set for homeassistant and that your homeassistant container is not using a base url server { listen 443 ssl; listen [::]:443 ssl; server_name homeassistant.*; include /config/nginx/ssl.conf; client_max_body_size 0; # enable for ldap auth, fill in ldap details in ldap.conf #include /config/nginx/ldap.conf; # enable for Authelia #include /config/nginx/authelia-server.conf; location / { # enable the next two lines for http auth #auth_basic "Restricted"; #auth_basic_user_file /config/nginx/.htpasswd; # enable the next two lines for ldap auth #auth_request /auth; #error_page 401 =200 /ldaplogin; # enable for Authelia #include /config/nginx/authelia-location.conf; include /config/nginx/proxy.conf; resolver 127.0.0.11 valid=30s; set $upstream_app 192.168.86.66; set $upstream_port 8123; set $upstream_proto http; proxy_pass $upstream_proto://$upstream_app:$upstream_port; } location /api { include /config/nginx/proxy.conf; resolver 127.0.0.11 valid=30s; set $upstream_app 192.168.86.66; set $upstream_port 8123; set $upstream_proto http; proxy_pass $upstream_proto://$upstream_app:$upstream_port; } } My VM is using the br0 network bridge. I'm pulling my hair out trying to figure this out, any help would be appreciated! Quote Link to comment
r0b0t_ears Posted October 21, 2021 Share Posted October 21, 2021 I know this is a little old, and maybe you figured it out already, but do you still have to designate the reverse proxy as trusted via your configuration.yaml file in home assistant? I forgot about that change to HA where you need to set 'use_x_forwarded_for' to 'true' and list the reverse proxy by IP under the http: config. Kind of like the below maybe? http: use_x_forwarded_for: true trusted_proxies: - 172.30.33.4 #or whatever your proxy is ip_ban_enabled: true login_attempts_threshold: 5 Quote Link to comment
TheBurgundyBear Posted December 27, 2021 Share Posted December 27, 2021 On 10/20/2021 at 9:35 PM, r0b0t_ears said: I know this is a little old, and maybe you figured it out already, but do you still have to designate the reverse proxy as trusted via your configuration.yaml file in home assistant? I forgot about that change to HA where you need to set 'use_x_forwarded_for' to 'true' and list the reverse proxy by IP under the http: config. Kind of like the below maybe? http: use_x_forwarded_for: true trusted_proxies: - 172.30.33.4 #or whatever your proxy is ip_ban_enabled: true login_attempts_threshold: 5 This was necessary to get things working in my set up, however, I can't access HA locally now! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.