I was getting an error like:
websocket connect err: websocket: could not find upgrade header with token 'websocket'
After checking a bunch of other things, I finally realized that it was Cloudflare (my free account) blocking the websocket connection. They apparently only offer websocket proxying for Enterprise customers at this time. I had to turn off proxying for my subdomain to get Mattermost to work (grey cloud).
it33
(Ian Tien)
October 19, 2015, 10:50pm
2
Thanks @jarrettlenox for the trouble shooting help!
Pyton
(Pyton)
April 8, 2016, 9:57am
3
Hi.
I have similar problem but I’m not using SSL
This is my basic NGINX configuration:
upstream gitlab_mattermost {
server 127.0.0.1:8065;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name domain;
server_tokens off;
client_max_body_size 128M;
access_log /var/log/nginx/gitlab_mattermost_access.log;
error_log /var/log/nginx/gitlab_mattermost_error.log;
location / {
proxy_redirect off;
proxy_set_header X-Forwarded-Proto http;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://gitlab_mattermost;
}
location /api/v1/websocket {
proxy_pass http://gitlab_mattermost;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
On Mattermose logs:
[2016/04/08 11:55:11 CEST] [EROR] websocket connect err: websocket: could not find upgrade header with token 'websocket'
[2016/04/08 11:55:11 CEST] [EROR] /api/v1/websocket:connect code=500 rid=n9njd8fnx7gymxrrb19wbji4ie uid=pq1jp3d5mf885cjt8jm5te11io ip=unknown Failed to upgrade websocket connection [details: ]
My Cloudflate is disabled (gray cloud).
Any idea?