How to fix Synology DSM Socket Close issue

A great feature of some models of the Synology NAS is to be able to run Docker containers directly from the DiskStation Manager (DSM - web-based operating system for every Synology NAS). You can search and download Docker images and configure and run new containers. Synology even gives you a terminal to access the containers.

What is a NAS?

The issue that motivated this blog post happens when the NAS is behind a reverse proxy. The DSM Reverse Proxy doesn’t support web socket by default, breaking the terminal app on Docker with the following exception:

Socket closed.

Despite the error message not being clear, the fix is quite simple:

  1. Open Control Panel and then Application Portal
  2. Select the Reverse Proxy tab
  3. Select the rule you want to fix and click in Edit
  4. At the Custom Header tab, create a new entry for Websocket

Now, the custom header should have the following two entries:

Reverse proxy rules at Synology DSM

Done! The docker terminal app should be working now.

o/