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

Haproxy support for draft 76 #4

Closed
majek opened this issue Dec 2, 2011 · 4 comments
Closed

Haproxy support for draft 76 #4

majek opened this issue Dec 2, 2011 · 4 comments

Comments

@majek
Copy link
Contributor

majek commented Dec 2, 2011

Reference: ninenines/cowboy#73

In order to get Hixie76 through a HAProxy loadbalancer the server must send response headers before the request nonce is received. In other words: before haproxy will send extra data from the client it expects the server to respond to the header. Current implementation does not support that. Example (nc localhost 8000 and paste):

GET /demo HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: example.com
Origin: http://example.com
Sec-WebSocket-Key1: 4 @1  46546xW%0l 1 5
Sec-WebSocket-Key2: 12998 5 Y3 1  .P00

Result:

HTTP/1.1 101 Web Socket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Origin: http://example.com
Sec-WebSocket-Location: ws://example.com/demo

��(�]#�������z2%

Expected result: server replying with headers, waiting for 8 byte nonce, and replying with nonce.

@jcoglan
Copy link
Collaborator

jcoglan commented Dec 4, 2011

I've tried connecting Safari, which uses draft-76 to my server via HAProxy and it works fine. How do I reproduce this problem?

@majek
Copy link
Contributor Author

majek commented Dec 4, 2011

Well, it doesn't work for me. Haproxy 1.4.15, here's simplified config:

defaults
    mode http
    # Set timeouts to your eneds
    timeout client  5s
    timeout connect 5s
    timeout server  5s

frontend all 0.0.0.0:9999
    mode http
    timeout client 120s

    option forwardfor
    option http-server-close
    option http-pretend-keepalive

    default_backend sockjs

backend sockjs
    balance uri depth 2
    timeout server  120s
    server srv_sockjs1 127.0.0.1:8080

@jcoglan
Copy link
Collaborator

jcoglan commented Dec 4, 2011

Fixed in 7e2461e.

@jcoglan jcoglan closed this as completed Dec 4, 2011
@jcoglan
Copy link
Collaborator

jcoglan commented Dec 5, 2011

This fix and the other bugs you reported are fixed in release 0.1.2. Thanks a lot for reporting them!

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