core: proxy access: Unable to connect to Home Assistant

Home Assistant release with the issue: 94.x, latest 95 betas

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.): HASS running in Python virtual environment with hass --open-gui

Component/platform:

Description of problem: I am connecting through a server to my home network

client -> public server -> home server

  • client is in the Internet
  • public server is runnning a TCP4 to TCP6 tunnel (using socat)
  • home server is behind a router with all ports opened, all running on IPV6

I get the login page, but sending credentials form leads me to “Unable to connect to Home Assistant.” page.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):


Traceback (if applicable):


Additional information: Running this setup for other services as well - never had an issue.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 18 (2 by maintainers)

Most upvoted comments

If you’re running it on Synology and are using the Application Portal reverse proxy, here what you need to configure:

Screenshot 2019-12-23 at 19 28 19

Control Panel > Applications Portal > Edit > Custom Headers

Well, it seems for me the problem wasn’t in HA, but in nginx, and not supporting websockets. If your proxy server doesn’t support websocket you will se that behavior. Add this to server section in nginx:

proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";

If you are running Nginx Proxy Manager, be sure to select this: image

For the apache users:

<VirtualHost *:443>
    SSLEngine on
    SSLProxyEngine On
    ServerName home.mydomain.com

    <Proxy *>
        Allow from localhost
    </Proxy>

    Header add Connection "Upgrade"
    RequestHeader set Connection "Upgrade"

    RewriteEngine on
    RewriteCond %{HTTP:Upgrade} =websocket
    RewriteRule /(.*)     ws://192.168.1.192:8123/$1  [P,L]
    RewriteCond %{HTTP:Upgrade} !=websocket
    RewriteRule /(.*)     http://192.168.1.192:8123/$1 [P,L]
    ProxyPass / http://192.168.1.192:8123/
    ProxyPassReverse / http://192.168.1.192:8123/
    Header add Connection "Upgrade"
    RequestHeader set Connection "Upgrade"
    ProxyRequests Off

</VirtualHost>

where 192.168.1.192:8123 is then of course the IP address of your Home Assistant instance.

@berengamble Thank you!!! That solved my issue!

Note that it essentially adds the lines suggested by @Ebbe to the .conf, but it’s nice that it’s built into NginxProxyManager.

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;