Eliminating "Unable to connect to Home Assistant - Retry"

I frequently get “Unable to connect to Home Assistant - Retry” messages when attempting to open HA (Hassio) both from Chrome on Windows and Chrome on Android. Clicking/tapping Retry successfully connects after one or two tries.

I am using xxxx.duckdns.org with Caddy.

Is this expected behavior? Any suggestions how to eliminate these messages and always connect successfully? That would greatly improve partner approval factor.

Thanks.

I also have had this problem for a long time. I am running HA in docker behind a Traefik reverse proxy. Would love a solution to this too.

2 Likes

Disabling http/2 in your proxy should be enough to remove the message. I’m on mobile right now so I can’t post the config. Ping me if you can’t find the flag and need an example.

I have the same issue, it’s really irritating. Using NGINX as reverse proxy.

Did anyone ever solve this? It really bugs me…

I also have this, would be interested to understand what’s going on. Using Nginx too

Thanks for the tip. Are you using Caddy by any chance? I tried disabling http/2 in my Caddyfile, but I can’t work out what the correct format should be. I’ve tried various locations/formats/bracketing of http2 off using the (sub)directives alpn and tls according to the vague instructions here https://github.com/mholt/caddy/pull/1389 and here https://caddyserver.com/docs/tls. Everything I’ve tried results in an unknown directive or unknown subdirective error.

Here is the working (apart from the original issue in this thread) beginning of my Caddyfile.

xxxxxx.duckdns.org {
    header / {
    Strict-Transport-Security "max-age=31536000; includeSubdomains"
    X-XSS-Protection "1; mode=block"
    X-Content-Type-Options "nosniff"
    X-Frame-Options "SAMEORIGIN"
    Referrer-Policy "same-origin"
    }
    proxy / localhost:8123 {
        websocket
        transparent
    }
}

OK, I’ve disabled http/2 with Caddy thanks to a tip on Github. So far, @Florian, disabling http2 appears to have done the trick. I haven’t yet had an “unable to connect” message with several connections from both my laptop and phone. Fingers crossed. I’ll watch it and report back after a couple of days if the error is gone for good. Thanks.

For anyone else looking, the correct format in my Caddyfile follows. The key is enabling only http/1.1. Doing that disables http/2.

xxxxxxxx.duckdns.org {
    header / {
    Strict-Transport-Security "max-age=31536000; includeSubdomains"
    X-XSS-Protection "1; mode=block"
    X-Content-Type-Options "nosniff"
    X-Frame-Options "SAMEORIGIN"
    Referrer-Policy "same-origin"
    }
    proxy / localhost:8123 {
        websocket
        transparent
    }
    tls {
    alpn http1.1
    }
}

The relevant section to add is:

    tls {
    alpn http1.1
    }
1 Like

Any idea how to disable http/2 with nginx?

I’m ready to declare victory. No more retry prompts.

Thanks so much, @Florian, for the suggestion to turn off http/2. This had driven me crazy for months.

Very much appreciated, was wondering why this was happening.

@srk23 I would recommend using nginx-proxy-manager if you’re not very experienced with nginx. It has a nice web based GUI which also includes this option. There’s also a hassio add-on for it.

Thanks for the pointer. Switched to the nginx proxy manager and after a bit of fiddling, problem seems to have gone away.

I also had that problem and I was using NGINX Proxy Manager (NPM) and a duckdns.org domain. I found that I had to enable the Websockets Support in NPM. I didn’t had any issue with HTTP/2 as I have it enabled and its working fine!

1 Like

Would you mind to share relevant part of config file? Thanks

For the host, besides websockets support, I have configured Block Exploits. In the SSL settings, I have Force SSL, HTTP/2 and HSTS enabled. All was done using the GUI and I didn’t had to add or edit any configuration.


  # Block Exploits
  include conf.d/include/block-exploits.conf;

  # HSTS (ngx_http_headers_module is required) (31536000 seconds = 1 year)
  add_header Strict-Transport-Security "max-age=31536000; preload" always;

  location / {

    # Force SSL
    include conf.d/include/force-ssl.conf;

    # HSTS (ngx_http_headers_module is required) (31536000 seconds = 1 year)
    add_header Strict-Transport-Security "max-age=31536000; preload" always;
    
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;

    # Proxy!
    include conf.d/include/proxy.conf;
  }
1 Like

Looks to me like you’re also not using http/2 :thinking:

In the beginning of the configuration file there is this:
listen 4443 ssl http2;

And it seems to be working properly.

has anybody fixed this issue when using traefik v2? Traefik does not support explicitly disabling http2.

1 Like

How can I disable http/2 on hass.io?

Hello,

To anyone how dealt with this problem : don’t forget to clean your cookies after any change.

If you don’t want to clean every single cookie, for example in chrome, click the padlock to the left of the adress bar, then “cookies”, then select and erase.

Maybe you found the solution and you don’t know it :slight_smile:

Michel