WebSocket Not Working in Production – Docker Server Rejects Connections
Hi Wasp team,
I am experiencing an issue with WebSocket connections in my self-hosted production environment. After investigating, I found that the Docker server itself is rejecting WebSocket connections.
Issue Summary:
WebSockets work perfectly in my local environment.
REST API works fine in production, so Nginx is correctly forwarding requests to the backend.
However, WebSocket connections fail in production, and after debugging, I found that the Docker server is not accepting WebSocket requests.
What I’ve Tried:
Checked Nginx configuration → WebSocket settings are correctly set (proxy_set_header Upgrade $http_upgrade;, etc.).
Tested direct WebSocket connection inside the server (curl -i -N -H "Upgrade: websocket" ...) → Docker returns "400 Bad Request - Transport unknown".
Checked logs from my backend service inside the Docker container → No WebSocket connections are being registered, meaning the requests are not reaching socket.io.
It seems that WebSocket requests are being blocked or not properly handled inside the Dockerized Wasp backend.
Question:
How should I configure Wasp + Docker to ensure WebSockets work correctly in production? Are there any specific settings required for WebSocket support in a self-hosted Docker setup?
Thanks in advance for your help!
Best regards,
Taha
I am experiencing an issue with WebSocket connections in my self-hosted production environment. After investigating, I found that the Docker server itself is rejecting WebSocket connections.
Issue Summary:
WebSockets work perfectly in my local environment.
REST API works fine in production, so Nginx is correctly forwarding requests to the backend.
However, WebSocket connections fail in production, and after debugging, I found that the Docker server is not accepting WebSocket requests.
What I’ve Tried:
Checked Nginx configuration → WebSocket settings are correctly set (proxy_set_header Upgrade $http_upgrade;, etc.).
Tested direct WebSocket connection inside the server (curl -i -N -H "Upgrade: websocket" ...) → Docker returns "400 Bad Request - Transport unknown".
Checked logs from my backend service inside the Docker container → No WebSocket connections are being registered, meaning the requests are not reaching socket.io.
It seems that WebSocket requests are being blocked or not properly handled inside the Dockerized Wasp backend.
Question:
How should I configure Wasp + Docker to ensure WebSockets work correctly in production? Are there any specific settings required for WebSocket support in a self-hosted Docker setup?
Thanks in advance for your help!
Best regards,
Taha