Enabling WebSocket on Synology

Hello,

I installed the vaultwarden container and set up nginx. I can access the web frontend and also /notifications/hub/negotiate - but I cannot access /notifications/hub as this will result in 502 Bad Gateway.

I enabled WebSocket setting WEBSOCKET_ENABLED to true in the docker environment.

I did not change the WebSocket Port 3012, so it is also 3012 outside of docker.

This is the configuration of NGINX:

server {
        include                 /etc/nginx/ssl.conf;
        server_name             vaultwarden.mydomain.tld;

        location /notifications/hub {
                proxy_pass              http://192.168.178.1:3012/;
                proxy_set_header        Host $host;

                proxy_http_version      1.1;
                proxy_set_header        Upgrade $http_upgrade;
                proxy_set_header        Connection "upgrade";

                proxy_set_header        X-Real-IP $remote_addr;
                proxy_set_header        Forwarded $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header        X-Forwarded-Proto $scheme;
        }
}

Is there a way to check if WebSocket is running in the docker container? I have no clue what is the issue with my setup.

Any help is appreciated!

It seems that WebSocket is working, but isn’t returning anything in the browser. The log shows this when I am trying to access the site: [2022-11-11 21:42:48.060][vaultwarden::api::notifications][INFO] Accepting WS connection from 172.17.0.1:60158

Is this the normal behaviour?

The instructions above are obsolete.

I had to sync manually and this issue informed me that WebSocket notifications had to be enabled which led me to this very thread.

On synology’s DSM 7.1 you simply click Control Panel->Login Portal->Advanced->Reverse Proxy->vaultwarden->Edit->Custom Header->Create->WebSocket
Save

The italics “vaultwarden” entry above will be whatever name you gave when you configured reverse proxy for your vaultwarden server. That’s it, no environment variables needed.

Enjoy almost instant automatic syncing.