[SOLVED] Issue with WebSocket and NGINX reverse proxy

So, installed HASSOS on x86 hardware, all works perfectly. Can connect directly (10.0.0.2:8123) and such.

Setup NGINX reverse proxy (10.0.0.1) for remote access with following config:

server {
        server_name ha.xxx.com;
        listen 443 ssl; 
        http2 on;

        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";

        proxy_buffering off;

    location / {
        proxy_pass http://10.0.0.2:8123/;
        proxy_set_header Host $host;
        proxy_redirect http:// https://;
        proxy_http_version 1.1;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

And dropped this into my configuration.yaml (from file editor):

http:
  use_x_forwarded_for: true
  trusted_proxies: 
    - 10.0.0.0/24

Reloaded configuration / restarted HA.

Now, accessing via proxy kinda works, but often fails. From firefox network console i can clearly see that the WebSocket fails to connect 9 times out of 10, but that random once does connect.

Any help on this? It seems that i cannot find anything meaningful in HA logs, and NGINX just complains that upstream blocked the connection.

Sometimes reloading the page helps, most of the time i only need to wait half a mitnute then the WebSocket will connect again.

Any help is appreciated?

might be some limiter / DDoS prevention in HA?

Here is a screenshot of firefox network console:

Solved: i had TWO devices with the same IP address, and one of them was indeed my HA instance.

Be careful! 4 days of heavy debugging! :slight_smile: