Remote access to homeassistant as a VM and swag/duckdns as a docker


Recommended Posts

Hey Guys,

 

i read now nearly every post about this subject...

it still dont want to work for me...
I got swag as a docker with a custom proxi network for bitwareden, nextcloud and vpn.

 

i got access to my homeassistant remotlie at ha.xxxx.de:8123

i dont get it to work with https://
 

home assistant configuration.yaml:

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 192.168.3.210 #unraid ip-adress
    - 172.18.0.2 #swag ip-adress

 

 

and of corse i renamed the proxy-config file in swag:

homeassistant.subdomain.conf

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name ha.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;


    location / {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app 192.168.3.10;
        set $upstream_port 8123;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }

    location ~ ^/(api|local|media)/ {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app 192.168.3.10;
        set $upstream_port 8123;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    }
}
 

 

as i said i can conect remot to ha.xxxx.de:8123
so the port forwarding is working. 

 

What could it be?..

 

thanks for your reading this!

 

Link to comment
  • 2 months later...

UP

 

Sorry to hijack your thread but i'm have the same problem. I moved from a 'homeassistant-core' docker to a VM and i cannot get remote access through HTTPS working.

 

HASS config:

 

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.17.0.3

 

Screenshot 2022-08-23 at 07-53-45 Nginx Proxy Manager.jpg

 

I cannot figure out if i have to look in homeassistant or NPM or maybe a unraid setting that's wrong.

Port forwarding in pfSense is setup correctly.

 

[SOLVED]

 

Ok, so i stumbled upon a topic in the Home Assistant Forums with some very usefull info. The home assistant logs tell you where the request is comming from. Look for this line located in the home assistant config folder, named like 'home-assistant.log.1'. I opened it with notepad++.

 

ERROR (MainThread) [homeassistant.components.http.forwarded] Received X-Forwarded-For header from an untrusted proxy 192.168.8.189

 

Note the IP adress at the end of the line and copy that in the home assistant configuration.yaml file.

 

http:

   use_x_forwarded_for: true

   trusted_proxies:

       -  192.168.8.189

 

It all makes sense to me now :)

 

Note: i use home assistant as a VM so my ip is in range of 192.168.#.### . If you use the docker version the IP may be more like 172.17.0.3 .

Edited by Aran
  • Thanks 1
  • Upvote 1
Link to comment
  • 3 months later...
  • 1 year later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.