[SOLVED] Issue with timeouts on Debian Wheezy with Nginx


I’ve just setup a new Mattermost 3.1.0 install on a Debian Wheezy server sitting behind NGINX and using MySQL 5.6. The install and setup where quick and easy. Site came up fine and appeared to work. However, I’ve noticed that I get timeouts in the browser when I try and post a message to a channel. I don’t see the blue bar at the top, but to the far right of the message the little wavy blue lines show and the message doesn’t show posted. If you refresh the page, it’s there.

I’ve followed the install instructions for Ubuntu, and my Nginx config is what is recommended. I don’t see any errors in the Mattermost log file or the Nginx logs. I’m not exactly sure what is going on or where to even troubleshoot without logs showing anything. Here is my Nginx config just in case that is useful.

Can anyone offer some suggestions? Thanks

server {
    listen 443 ssl;
    server_name chat.example.com;

    keepalive_timeout 10;

    ssl on;
    ssl_certificate /etc/ssl/localcerts/STAR_example.com.crt;
    ssl_certificate_key /etc/ssl/localcerts/STAR_example.com.key;

    ssl_session_timeout 5m;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;

    location / {
        gzip off;
        proxy_set_header X-Forwarded-Ssl on;
        client_max_body_size 50M;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        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-Forwarded-Proto $scheme;
        proxy_set_header X-Frame-Options SAMEORIGIN;


After a bit more troubleshooting, I’ve noticed when I hit the URL https://chat.example.com/api/v3/users/websocket directly, I get this message

Bad Request
{"id":"api.web_socket.connect.upgrade.app_error","message":"Failed to upgrade websocket connection","detailed_error":"","request_id":"11af9tzb83y37cfw4u4ugppykh","status_code":500,"is_oauth":false}

So I believe my setup for Nginx should allow for the HTTP connection to be upgraded to a websocket connection. Correct? Seems that it is setup properly.


Well, I tried upgrading from Wheezy default Nginx package version 1.2.1 to the backports version 1.6.2 and things work now. So, don’t know if there is a bug, or websockets are broken in that version. shrugs


One further comment. It looks like websockets wasn’t added in NGINX until version 1.3. So…you need at least that version for this to work. So either Backports, or dotdeb.org will have that.