WebSockets behind nginx proxy not working; how should I go about fixing this?

I've spent quite a long time trying to fix WebSockets not working behind my nginx reverse proxy. Let me just show the error, the nginx configuration, and the server.xml file. As far as I can tell, I've followed all the directions provided by Confluence for setting up the proxy. I'm on Debian 7 amd64. If you need any more data, let me know.

Any suggestions?

6 comments
Comment actions Permalink

Ah, I suppose it might be helpful to know that I'm on TeamCity Enterprise 9.0 (build 32060) (Open Source License).

0
Comment actions Permalink

Seems to work for me. The location block I use is:

    location / {
        proxy_pass            http://10.20.20.2:8111/;
        proxy_http_version    1.1;
        proxy_set_header      Host              $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-Host  $host;
        proxy_set_header      X-Forwarded-Proto $scheme;
        proxy_set_header      Upgrade           $http_upgrade;
        proxy_set_header      Connection        "upgrade";
        client_max_body_size  100M;
    }


My guess is the http version 1.1 statement.

0
Comment actions Permalink

I tried adding the HTTP version line, but it didn't fix the issue. I'm truly mind-boggled with this issue. It seems like it would work.

0
Comment actions Permalink

Oh, it's occurring to me that CloudFlare may have something to do with this. I've checked, and it does
support WebSockets, but it could be harming something in a way I'm not aware of.


0
Comment actions Permalink

Hi Kyle,

Please check that all requirements for WebSockets protocol are met.
Also it seems that CloudFlare supports WebSockets only for Enterprise customers, сould this be the problem?

0
Comment actions Permalink

Yeah, I switched off CloudFlare, which is the bane of my existence, causing far too many problems, and the WebSocket issue has resolved itself. Thanks for the support!

0

Please sign in to leave a comment.