elixir-socket
elixir-socket copied to clipboard
Use websocket client behind a proxy
Is there a way to use the websocket client if I have to use a proxy to connect to the websocket server? Looks like there is an additional request to the proxy needed before you're allowed to start the websocket connection.
First message sent from client to proxy:
CONNECT echo.websocket.org:80 HTTP/1.1
Host: echo.websocket.org:80
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 ...
Response from proxy to client:
HTTP/1.1 200 Connection established
Message sent from client to server over proxy, followed by response.
GET /?encoding=text HTTP/1.1
Host: echo.websocket.org
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: http://www.websocket.org
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 ...
Accept-Encoding: gzip, deflate, sdch
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: xxxx
Sec-WebSocket-Key: xxxx
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
HTTP/1.1 101 Web Socket Protocol Handshake
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Headers: authorization
Access-Control-Allow-Headers: x-websocket-extensions
Access-Control-Allow-Headers: x-websocket-version
Access-Control-Allow-Headers: x-websocket-protocol
Access-Control-Allow-Origin: http://www.websocket.org
Date: Wed, 25 Jan 2017 12:58:37 GMT
Sec-WebSocket-Accept: xxxx
Server: Kaazing Gateway
Upgrade: websocket
Connection: Upgrade
For me it looks like the second part should be the same in an environment without a proxy. So is there a way to inject this first block where the client talks to the proxy?
Thanks for looking into this.