问题
I use tornado develop a websocket server, and I use nginx delegate the python server, the nginx config a server_name, and my server in Chian, and I connect the websocket server from China, it work OK, and I connect it from Australia use Wifi, it also work OK, but when I connect from Australia use 3G, it doesn't work, the request header miss upgrade node, why this happen?
回答1:
Because there is a proxy in the middle of that 3G connection.
The "Upgrade" header is marked as a connection header ("Connection:Upgrade"), that means that header must be removed in the next hop. So proxies remove that header.
You should use a secure WebSocket (wss://) to avoid proxies messing with your headers.
How HTML5 Web Sockets Interact With Proxy Servers
Cheers.
来源:https://stackoverflow.com/questions/23520653/websocket-request-header-miss-upgrade