Frontend: When HA tab has closed for a while, on repoen I get Unable to connect, Retry - and if I refresh it works.

Created on 3 Apr 2019  路  3Comments  路  Source: home-assistant/frontend

Home Assistant release with the issue: 0.90.2

Last working Home Assistant release (if known): I'm not sure it's ever worked that way

Operating environment (Hass.io/Docker/Windows/etc.): python venv, debian, everything up-to-date, updated with pip etc

Component/platform:

Description of problem:
So I have a dedicated home-assistant running on port 8123 (lets call it HA), I also have a server that I have multiple stuff on that I use to create the vhosts for my things (let's call it SRV), so from my router I nat ports 80 and 443 to that server, it runs nginx and has a vhost for home-assistant which it proxies to port 8123 on the home-assistant box. So the full setup is internet->router->SRV->HA. I've followed the documentation here https://www.home-assistant.io/docs/ecosystem/nginx/ and it all works pretty well apart from one small issue.

If the tab with home assistant has been closed for a while, and I open it - I immediately get "Unable to connect to Home Assistant" and a retry button, clicking it or refreshing the page works and then home-assistant works perfectly fine. I reproduce that problem from home, from work, on my phone. I have a feeling it has something to do with a keep-alive thing, or websocket or something like that but I have no idea how to debug further. Attached below are some logs that might help.

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

http:
  server_port: 8123
  ip_ban_enabled: True
  login_attempts_threshold: 50
  use_x_forwarded_for: true
  base_url: https://ha.my_actual_domain.tld
  trusted_proxies: 
    - 192.168.1.1
    - 192.168.1.2

Traceback (if applicable):


Additional information (nginx logs on the SRV that proxies to HA) from when I get the Retry screen:

192.168.1.1 - - [03/Apr/2019:23:18:18 +0300] "POST /auth/token HTTP/2.0" 200 216 "https://ha.my_actual_domain.tld/" "Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36"
192.168.1.1 - - [03/Apr/2019:23:18:18 +0300] "GET / HTTP/2.0" 200 2872 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36"
192.168.1.1 - - [03/Apr/2019:23:18:18 +0300] "GET /api/websocket HTTP/2.0" 400 21 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36"

Additional information (home-assistant logs) from when I get the Retry screen:

Apr 03 23:18:18 HomeAssistant homeassistant-start.sh[11076]: 2019-04-03 23:18:18 INFO (MainThread) [homeassistant.components.http.view] Serving / to 192.168.1.1 (auth: False)
Apr 03 23:18:18 HomeAssistant homeassistant-start.sh[11076]: 2019-04-03 23:18:18 INFO (MainThread) [homeassistant.components.http.view] Serving /auth/token to 192.168.1.1 (auth: False)
Apr 03 23:18:18 HomeAssistant homeassistant-start.sh[11076]: 2019-04-03 23:18:18 INFO (MainThread) [homeassistant.components.http.view] Serving /api/websocket to 192.168.1.1 (auth: False)
stale

Most helpful comment

I see the same issue from time to time.

All 3 comments

I see the same issue from time to time.

I have been trying to figure out why I have been experiencing the samething. I too have nginx handling all requests for anything web and proxying to the appropriate services.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

move[bot] picture move[bot]  路  3Comments

Fusseldieb picture Fusseldieb  路  4Comments

TheZoker picture TheZoker  路  3Comments

jhollowe picture jhollowe  路  4Comments

GauthamVarmaK picture GauthamVarmaK  路  3Comments