Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use websocket client behind a proxy #72

Open
tht opened this issue Jan 25, 2017 · 0 comments
Open

Use websocket client behind a proxy #72

tht opened this issue Jan 25, 2017 · 0 comments

Comments

@tht
Copy link

tht commented Jan 25, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant