Websockets for Synology DSM
It’s happened to me several times now that an application I run on my DS 1817+ has problems with websockets. This is because I use the reverse proxy built into DSM, which does not support websockets by default. For this reason, here’s a little tutorial on how to enable Websockets for Synology DSM reverse proxy.
Enable Websockets in DSM Reverse Proxy
Actually, it is extremely easy to enable Websockets for Synology DSM reverse proxy:
- Open Control Panel > Application Portal
- Change to the Reverse Proxy tab
- Select the proxy rule for which you want to enable Websockets and click on Edit
- Change to the Custom Headers tab
- Add two entries in the list:
- Name: “Upgrade”, Value: “$http_upgrade”
- Name: “Connection”, Value: “$connection_upgrade”
Repeat these steps for every rule where you want to enable Websockets.
In my local setup, I need this for GitLab Mattermost (running within a docker container) and DSM Virtual Machine Manager Console.
19 COMMENTS
Running into authentication issues with Home Assistant I’ve found your write-up and wanted to say thanks for this excellent explanation!
It appears this is now available by default: just click the down arrow on the Create button in that Custom Headers tab, and select “WebSocket”.
Oh, I didn’t know that! Thank you very much!
[…] If you’re using the DSM reverse proxy, you can still use GitLab’s capabilities for getting LetsEncrypt certificates or configure HTTPS offloading (the reverse proxy terminates the HTTPS connection and forwards requests internally using HTTP) and use DSM’s capabilities for getting LetsEncrypt certificates. When configuring the hosts, please be sure to enable Websocket Support. […]
THANK YOU!! This helped me get Hasura working with subscriptions on my synology.
So grateful for your post, helped me out running rocket chat behind synology reverse proxy. On mobile phone app gave me websocket related error and with your guide fixed the problem!
Your instructions were so clear and worked perfectly.
You helped me a lot.
Thank you very much Matthias 😉
Yes ! it’s save me a lot of time !
Thanks
For WebSockets also add the header “Origin” and make it “”
Is it possible to use a wss connection?
What exactly do you mean with use? Using this configuration example, you’re able to provide a wss connection.
Was looking for this. Great and easy solution. Thanks!
Thanks, Matthias,
I was struggling with “code server” and reverse proxy until I found your post!
Glad it helped 🙂
Just wanted to say this is absolutely necessary to get reverse proxy to work with The Spaghetti Detective if you are using the reverse proxy of DSM. It took me forever to figure out websockets was the culprit, and after doing this, it works PERFECTLY. I’m currently running DSM 7 on a 920+.
Yaay! With your tutorial I managed to move my diabetes management system from a commercial cloud environment (Heroku) to my Synology. I had fiddled around whole day before I found your blog. I’m extremely happy, thank you so much for sharing your knowledge!
Thanks so much for this post! Didn’t realize how easy enabling Web Sockets was, and makes a lot of my self hosted apps work way better.
Thanks very much. I have a private Synology home server. I reinstalled Onlyoffice – in Docker. I had problems with the recent update of Onlyoffice 7.3 – the connection between Nexcloud Onlyoffice didn’t work. According to GitHub, the bug was found. (Library for exchanging data with the server changed from sockjs to socket.io) Unfortunately, Synology does not offer direct access to Apache2 with a .conf file. In addition to the schema extension of the Onlyoffice dB, I applied the hint from you. And yes – everything works again – as it should. Thank you Paulo
Thanks so much for this. I have a bunch of web servers running in containers on my Synology DS918+, as well as elsewhere on my LAN, which I want to be accessible on my LAN/VPN only (no WAN access). And I want each of those servers to be available with a domain name and without the port suffix.
So I’ve setup AdGuard on my Synology for DNS / ad blocking, and am using DNS rewrites to point all subdomains xxx.mydomain.co.uk to the IP of the Synology. I’m then using the DSM reverse proxy to forward traffic to the relevant IPs/ports of my servers, including my UDM Pro. The added bonus of this setup is that all internal servers can then utilize the certificate of the reverse proxy (DSM) which I have set to auto-renew using acme.sh!
This was working perfectly for all other web servers, and I was able to login to the UDM Pro, but then the console page would hang. Chrome developer tools showed me that the wss call was failing, which brought me here.
Thanks so much again, this fixed the issue within seconds!