Wednesday, March 17, 2010

* sites return empty pages when accessed via squid

The webserver (which serves and among others) sends back a chunked HTTP request "Transfer-Coding: chunked" in response to a HTTP 1.0 GET. The Transfer-Coding header is not valid for HTTP 1.0 and the HTTP 1.1 RFC is very clear:
A server MUST NOT send transfer-codings to an HTTP/1.0 client

In firefox the page renders as empty. If you view source you can see part of the page (i.e. the first chunk) was downloaded, but the full content has been truncated.

Moving squid to HTTP 1.1 should probably fix this, except according to squid.conf it won't:

# Enables HTTP/1.1 support to clients. The HTTP/1.1
# support is still incomplete with an internal HTTP/1.0
# hop, but should work with most clients. The main
# HTTP/1.1 features missing due to this is forwarding
# of requests using chunked transfer encoding (results
# in 411) and forwarding of 1xx responses (silently
# dropped)

So the solution is to drop the accept-encoding header for the domain:

acl dstdomain
header_access Accept-Encoding deny

OR if you are using IE, apparently you can untick "Use HTTP1.1 through proxy connections" in IE’s Advanced internet options tab.

No comments: