I have switched my local setup to use HTTP instead of HTTPS so that I can compare all HTTP Requests and Responses with ngrep. I had side-by-side terminals opened. The Requests were all ok, Here is the request from browser to pound:

T 2012/05/09 17:28:25.722352 127.0.0.1:36815 -> 127.0.0.1:8080 [AP]
GET /nginx-poll/?key=abc HTTP/1.1.
Host: example:8080.
Connection: keep-alive.
Cache-Control: no-cache.
If-Modified-Since: Wed, 09 May 2012 15:28:25 GMT.
Pragma: no-cache.
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19.
If-None-Match: 0.
Accept: */*.
Referer: http://example.com:8080/.
Accept-Encoding: gzip,deflate,sdch.
Accept-Language: en-US,en;q=0.8.
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3.
Cookie: BUNCH_OF_COOKIES.
.

And here is the HTTP Request the pound sends to Nginx:

T 2012/05/09 17:28:25.724359 127.0.0.1:33670 -> 127.0.0.1:81 [A]
GET /nginx-poll/?key=abc HTTP/1.1.
Connection: keep-alive.
Cache-Control: no-cache.
If-Modified-Since: Wed, 09 May 2012 15:28:25 GMT.
Pragma: no-cache.
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19.
If-None-Match: 0.
Accept: */*.
Referer: http://example.com:8080/.
Accept-Encoding: gzip,deflate,sdch.
Accept-Language: en-US,en;q=0.8.
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3.
Cookie: BUNCH_OF

T 2012/05/09 17:28:25.724371 127.0.0.1:33670 -> 127.0.0.1:81 [AP]
_COOKIES.
host: example.com.
X-Forwarded-For: 127.0.0.1.
.


And now the corresponding responses. First, we start wit the Response of Nginx:

T 2012/05/09 17:28:45.355341 127.0.0.1:81 -> 127.0.0.1:33633 [AP]
HTTP/1.1 304 Not Modified.
Server: nginx/1.0.14.
Date: Wed, 09 May 2012 15:28:45 GMT.
Content-Type: application/json.
Last-Modified: Wed, 09 May 2012 15:28:45 GMT.
Connection: keep-alive.
Transfer-Encoding: chunked.
Etag: 0.
.


T 2012/05/09 17:28:45.355381 127.0.0.1:81 -> 127.0.0.1:33633 [AP]
0.
.

As we can see, there is chunk which ends the response.

And here comes the response the pound sends from Nginx to the browser:

T 2012/05/09 17:28:45.355581 127.0.0.1:8080 -> 127.0.0.1:36811 [AP]
HTTP/1.1 304 Not Modified.
Server: nginx/1.0.14.
Date: Wed, 09 May 2012 15:28:45 GMT.
Content-Type: application/json.
Last-Modified: Wed, 09 May 2012 15:28:45 GMT.
Connection: keep-alive.
Transfer-Encoding: chunked.
Etag: 0.
.


As you can see immidiately, there is no chunk which ends this message and Google Chrome cannot parse the complete response. Due to the fact that Google Chrome is really strict in parsing chunked response messages, this issue should be fixed in pound.



On Tue, May 8, 2012 at 9:15 AM, Dennis Becker <becker@sipgate.de> wrote:
Hi,

we have a setup where pound is the load balancer in front of a NGinx Long Polling server. I can reproduce an issue where after a long poll ends with "HTTP 304 not modified", the next HTTP response message is corrupt. You'll get in Google Chrome messages like this:

0

HTTP/1.1 200 OK
Server: nginx/1.0.14
Date: Tue, 08 May 2012 05:58:03 GMT
Content-Type: application/json
Last-Modified: Tue, 08 May 2012 05:57:33 GMT
Connection: close
Etag: 0
Transfer-Encoding: chunked

2159
{"REMOVED_BODY_CONTENT"}

I also have this issue with a Lighttpd behind Pound using chunked encoding.

Google Chrome is really strict in it's parsing rules for chunked encoding. See http://code.google.com/p/chromium/issues/detail?id=39206#c12 


I have found the issue with pound 2.5 but have also the same error with pound 2.6 and 2.7.


When I use Apache as proxy everything works fine.

--
 Dennis Becker   becker@sipgate.de
 Telefon:        +49 (0) 211-63 55 55-97
 Telefax:        +49 (0) 211-63 55 55-22

 sipgate GmbH - Gladbacher Str. 74 - 40219 Düsseldorf
 HRB Düsseldorf 39841 - Geschäftsführer: Thilo Salmon, Tim Mois
 Steuernummer: 106/5724/7147, Umsatzsteuer-ID: DE219349391

 www.sipgate.de - www.sipgate.at - www.sipgate.co.uk



--
 Dennis Becker   becker@sipgate.de
 Telefon:        +49 (0) 211-63 55 55-97
 Telefax:        +49 (0) 211-63 55 55-22

 sipgate GmbH - Gladbacher Str. 74 - 40219 Düsseldorf
 HRB Düsseldorf 39841 - Geschäftsführer: Thilo Salmon, Tim Mois
 Steuernummer: 106/5724/7147, Umsatzsteuer-ID: DE219349391

 www.sipgate.de - www.sipgate.at - www.sipgate.co.uk