After installing Coolify on my homelab and proxying it with Nginx Proxy Manager (NPM), I ran into an issue. Even with WebSockets Support enabled, I kept getting warnings in the UI and browser console about failed WebSocket connections.
The problem was that Coolify uses different routes and ports for WebSockets, and configuring NPM to handle this correctly isnât obvious.
Hereâs how to properly set up custom locations in NPM when you need them:
Basic Setup
- First, create your proxy host with the main website configuration
- Enable WebSockets in the main configuration if needed
- Add custom locations for specific paths requiring special handling
Adding WebSocket Custom Locations
From your proxy host details page, click âCustom Locationsâ and then âAdd Locationâ :
Configure the Basic Fields
- Location: Enter the path (e.g.,
/app
or/terminal/ws
) - Scheme: Select
http
(orhttps
if your backend uses SSL) - Forward Hostname / IP: Enter the IP address only (e.g.,
192.168.1.12
)- that is, without the path used in location
- Forward Port: Enter the specific port for this path (e.g.,
6001
)
Configure Advanced Settings
In the text area that shows up after clicking the gear icon, you must include the complete location block configuration.
location /your-path {
proxy_pass http://your-ip:your-port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_read_timeout 86400;
}
Youâd expect the textarea
âs contents to be inserted in the block generated from the mandatory inputs, but that wonât work. Donât ask me why.
Coolify example
Coolify has two different WebSocket paths:
For /app
WebSocket:
- Location:
/app
- Scheme:
http
- Forward IP:
192.168.1.12
- Port:
6001
- Advanced Config:
location /app {
proxy_pass http://192.168.1.12:6001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_read_timeout 86400;
}
For /terminal/ws
WebSocket:
- Location:
/terminal/ws
- Scheme:
http
- Forward IP:
192.168.1.12
- Port:
6002
- Advanced Config:
location /terminal/ws {
proxy_pass http://192.168.1.12:6002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_read_timeout 86400;
}
Troubleshooting
- If your proxy shows offline, check the generated Nginx configuration. Youâll find them under
/data/nginx/proxy_host
. Numbers will match whatâs in the UI.
- Check your firewall configuration with
ss -tuln
. The application ports youâre trying to proxy should be in the list. - Ensure that the location path in the Advanced tab exactly matches the Location field