# Gladys and NGINX

**URL:** <https://community.gladysassistant.com/t/gladys-et-nginx/8548>\
**Category:** Configuration\
**Created:** [November 27, 2023, 9:27pm UTC](https://community.gladysassistant.com/t/gladys-et-nginx/8548 "2023-11-27T21:27:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romuald\_Pochet](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/romuald_pochet/32/6441_2.png) [@Romuald\_Pochet](https://community.gladysassistant.com/u/Romuald_Pochet)\
**Post date:** [November 27, 2023, 9:27pm UTC](https://community.gladysassistant.com/t/gladys-et-nginx/8548/1 "2023-11-27T21:27:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Francois\_H](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/francois_h/32/15453_2.png) [@Francois\_H](https://community.gladysassistant.com/u/Francois_H)\
**Post date:** [June 2, 2024, 3:00pm UTC](https://community.gladysassistant.com/t/gladys-et-nginx/8548/2 "2024-06-02T15:00:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![grosminet](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/g/8491ac/32.png) [@grosminet](https://community.gladysassistant.com/u/grosminet)\
**Post date:** [June 3, 2024, 4:36am UTC](https://community.gladysassistant.com/t/gladys-et-nginx/8548/3 "2024-06-03T04:36:14Z")

</div>

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

```auto
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
