keesschollaart81 / vscode-home-assistant

Visual Studio Code Extension for Home Assistant. ⭐ if you think this is cool!
529 stars 112 forks source link

Unable to connect | Nginx Proxy Manager #3069

Open jonalbr opened 4 months ago

jonalbr commented 4 months ago

Problem

Hi, I am unable to connect to my home assistant server. I'll get these two exceptions:

WebSocket Connection to Home Assistant closed with an error: Disconnected from Home Assistant with a WebSocket error with message: connect ECONNREFUSED first_parts_of_public_ipv6_adrr : unnown_parts :8123

Error connecting to your Home Assistant Server at https://xxx.myfritz.net:8123 and token 'eyJhb...', check your network or update your VS Code Settings, make sure to (also) check your workspace settings! Error: ERR_CANNOT_CONNECT

It's possible for me to connect to the home assistant dashboard via my host url address. It might be a Nginx Proxy Manager misconfiguration on my part, but I am unsure how to fix that, so this vsc plugin can connect to home assistant.

My home assistant config:

http:
  use_x_forwarded_for: true # To ensure HA understands that client requests come via reverse proxy
  trusted_proxies:
    - 192.168.200.10 # localhost IPv4 address of ha
    - fd00::xxxx # localhost IPv6 address of ha
    - 172.30.33.0/24

My Vscode-home-assistant extension config:

"vscode-home-assistant.hostUrl": "https://xxx.myfritz.net:8123",
"vscode-home-assistant.ignoreCertificates": true,
"vscode-home-assistant.longLivedAccessToken": "eyJhb...",
}

My Nginx Proxy Manager Config:

domain name: xxx.myfritz.net
scheme: http
forward hostname: homeassistant
forward port: 8123
cache assets: false
block commen exploids: true
websockets support: true
access list: publicy accessible
custom locations: -
ssl: {
  force ssl: true
  http/2 support: true
  hsts enable: false
  hsts subdomain: false
}
advanced: -

Router config: External port 8123 is forwarded to 443

Thank you very much for your effort! Jonas

Extension runs in:

I'm running VS Code on:

I'm accessing my files:

poldim commented 3 weeks ago

I dont think you should be forwarding your WAN to 8123. The whole point of the RP is to handle all of the routing for you. I'd recommend you do some more reading/watching on what nginx does and where it sits in the communication flow.