Gladys and NGINX

Good evening,

I’m trying to put Gladys behind an NGINX and I’m having an issue with WebSockets. I see that it’s possible to define an environment variable WEBSOCKET_URL but it is not taken into account (I defined WEBSOCKET_URL just like SERVER_PORT and NODE_ENV, which do not cause any issues, but you can see they are defined in the Dockerfile).

Any idea?

Thanks in advance,

R.

I am also trying to use a reverse proxy with nginx and I’m getting errors.
I added a few lines to the nginx config to allow WebSockets, which allowed the zigbee2mqtt interface to work behind the reverse proxy, but that’s not enough for Gladys.

For info, my config which is an nginx Docker acting as a reverse proxy for a Gladys Docker
it almost works but there are errors in the JS

server {
        listen 80;
        server_name gladys.my.lan;
        resolver 127.0.0.11;
        location ~ ^(.*)$ {
                absolute_redirect off;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-By domo.my.lan;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                set $upstream http://gladys:80;
                proxy_pass $upstream/$1$is_args$args;
                # Added so WebSockets (ws://gladys.my.lan) works
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_read_timeout 86400;
                proxy_http_version 1.1;
        }
}

The same configuration allows zigbee2mqtt to run behind the reverse proxy