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

Proxying through SSL hangs at response code 101 #15

Open
sirsiwsh opened this issue Mar 22, 2012 · 2 comments
Open

Proxying through SSL hangs at response code 101 #15

sirsiwsh opened this issue Mar 22, 2012 · 2 comments

Comments

@sirsiwsh
Copy link

Hi,

I've succesfully managed to get apache2 to understand websockets with the default example (*_echo.so)

http://foo/client.html (works, occasionally disconnect problem solved by increasing the body timeout like so:

RequestReadTimeout body=500,minrate=1

So then I tried to det everything running over SSL. I get a 403 error running the regular example, probably because the example code doesn't attempt to open a wss:// websocket. Meh, I know things work...

I then tried to proxy the excellent GateOne through the websocket. The setup is as below:
python gateone.py --diasble-ssl --url-prefix="/term/"
Gateone host: foo:port/term

ProxyPass /term 127.0.0.1:port
ProxyPassReverse /term http://127.0.0.1:port

When gateone initialises, it attempts to connect to a websocket at: wss://foo/term/ws
So, in my httpd.conf (protocols disabled to ensure testing compatibility):

<IfModule mod_websocket.c>
<Location /term/ws>
SetHandler websocket-handler
WebSocketHandler /usr/lib/apache2/modules/mod_websocket_tcp_proxy.so tcp_proxy_init
#  WebSocketTcpProxyBase64 on
WebSocketTcpProxyHost 127.0.0.1
WebSocketTcpProxyPort 444
#   WebSocketTcpProxyProtocol base64
RequestReadTimeout body=500,minrate=1

The problem is, I see in Chrome's activity that the websocket request (/term/ws) hangs at 101 (Switching Protocols).

Request URL:wss://foo/term/ws
Request Method:GET
Status Code:101 Switching Protocols

Sent headers:
Connection:Upgrade
Cookie:gateone_user=[snip]
Host:foo
Origin:https://foo
Sec-WebSocket-Key:4pNAoAlFCIbh/hjyaJAluA==
Sec-WebSocket-Version:13
Upgrade:websocket
(Key3):00:00:00:00:00:00:00:00

Response:
Connection:Upgrade
Sec-WebSocket-Accept:lQTZh4RECkdDfTJhlYPymy4zC1Y=
Upgrade:websocket
(Challenge Response):00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

Is there anything you can think of that could be causing this to hang? Do you know where I might be able to get some help please?

Thanks!

@disconnect
Copy link
Owner

If you use the client.html file for testing the echo WebSocket connection, it should work with https. It does use wss if the initial connection was https. I just double checked, and it does work with https/wss as expected. What browser are you using? Get that working first. One thing to check is that your certificate has not expired. Also, I've seen some instances where Chrome will not connect if the certificate is not trusted.

@ghost
Copy link

ghost commented Aug 20, 2012

I ran into this same issue with Chrome (Opera and Firefox work fine)
This seems to be unrelated to SSL, I tried disabling and using a reverse proxy setup similar to that above through a non-ssl http port, getting the same results, the request stalls at 101 Switching Protocols.

Interesting note though, this happens while using mod_websocket. In my particular scenario, when using mod_websocket_draft76 I get a WebSocket handshake error due to the Sec-WebSocket-Accept header being missing, Firefox also fails, probably for the same reason.
Opera seems to work fine with either module.

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

2 participants