C
Coder.com•3y ago
roshaan

Websocket connection failed (nginx websocket passthrough)

Have you ever encountered this?
No description
No description
11 Replies
kyle
kyle•3y ago
Humph, no I have not. Are you running through a proxy of any kind?
Phorcys
Phorcys•3y ago
I think I have seen this before, as kyle said, are you using a reverse-proxy?
roshaan
roshaanOP•3y ago
Oh yeah, sollution was adding a couple headers in the nginx conf file
Phorcys
Phorcys•3y ago
yup, could you send them here just for the record?
roshaan
roshaanOP•3y ago
No description
Phorcys
Phorcys•3y ago
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
# your server block here

location / {
proxy_pass_request_headers on;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Accept-Encoding gzip;
}
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
# your server block here

location / {
proxy_pass_request_headers on;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Accept-Encoding gzip;
}
}
alright, marking this as resolved actually can't do it because i'm on mobile but in a bit btw, @kyle can you pin this?
kyle
kyle•3y ago
Sure!
Phorcys
Phorcys•3y ago
thank you
kyle
kyle•3y ago
Done 🙂
roshaan
roshaanOP•3y ago
is this what you guys use in nginx?
kyle
kyle•3y ago
We don't currently proxy via nginx in our dogfood deployment (it lives at dev.coder.com).
Want results from more Discord servers?
Add your server