I have a websocket server running written in Python, (from ), and when I try to connect to it from my house, it works fine. However, when I try to connect to it from school, where there is a web proxy in place, it fails to connect with the error "undefined".
I believe that it is the proxy that is stopping the connection, but am not sure how to test to see if it definitely is. How can I test this, and if it is the proxy, how can I get round this?
Thanks
I have a websocket server running written in Python, (from https://github./opiate/SimpleWebSocketServer), and when I try to connect to it from my house, it works fine. However, when I try to connect to it from school, where there is a web proxy in place, it fails to connect with the error "undefined".
I believe that it is the proxy that is stopping the connection, but am not sure how to test to see if it definitely is. How can I test this, and if it is the proxy, how can I get round this?
Thanks
Share Improve this question asked Mar 3, 2015 at 8:41 user2370460user2370460 7,82011 gold badges34 silver badges46 bronze badges 1- From what I understand the websocket is a GET followed by a upgrade. Proxies will be blocking the upgrade part since they dont know how to handle it. Defining a rule in there to tell it what to do on upgrade request, websockets should work. – hyades Commented Mar 3, 2015 at 8:57
1 Answer
Reset to default 15Many proxy servers replace the headers of HTTP requests with their own. They will remove any headers they don't understand, so when the proxy doesn't support websocket yet it will prevent any websocket handshake from working.
As a workaround you can get a TLS certificate for your website and use https and wss. This encrypts the headers and thus prevents the proxy from messing with them.
By the way: You should support TLS anyway. In todays world you no longer need a good reason to use encryption, you need a good reason not to.