httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Mayi <>
Subject [users@httpd] websockets and chunked encoding
Date Mon, 14 Apr 2014 22:49:16 GMT

Not sure which part to blame - whether it is Apache, mod_passenger or a
browser - but my websocket handshake gets corrupted by apache sending it
using chunked encoding.

Following is the response packet that indicates switching to websocket:

HTTP/1.1 101 Switching Protocols
Date: Thu, 10 Apr 2014 15:21:28 GMT
Server: Apache/2.2.15 (CentOS)
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: S7wgnmtVSahQDCifkYwFlQajWcI=
X-Powered-By: Phusion Passenger 4.0.41
Status: 101 Switching Protocols
Transfer-Encoding: chunked
Content-Type: text/plain; charset=UTF-8


The problem is that right after that the server software (nodejs running
via mod_passenger) sends actual websocket frame but apache encodes it
using chunked encoding (prepends it with chunk length - the number 5 in
my example). Since the first byte of websocket frame is supposed to be
frame opcode the chunk length is taken by browser (tested with Chrome)
as this opcode and whole websocket is corrupted.

What's wrong? Is this apache's fault? I can see other webservers are not
using chunked encoding when connection gets upgraded to websocket... Any
way around the problem?

Thanks, Antony.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message