Can Squid 2.7 proxy gzipped content

cachehttp-headersPROXYsquid

We have a forward proxy for our network which is Squid 2.7. This is managed for us by a third party.

We noticed recently that http requests going from our network to the web were having the Accept-Encoding header removed. This was resulting in all web traffic across our network (approx 8000+ PCs) being uncompressed even though the browsers and server on each end were capable.

We have asked the third party to look into this and they have said it is because Squid 2.7 does not support compression.

I understand this to be true but I was under the impression that the compression happened on the webserver rather than the proxy. So…

  1. Can Squid 2.7 proxy and/or cache content that is gzipped?
  2. If it can, how/why might it be configured such that the
    Accept-Encoding header is being removed?

Best Answer

Squid 2.7 does cache compressed pages (multiple encodings of a page), if the user requests a compressed page. But if the user requests a non-compressed page, then squid will forward a requests asking for a non-compressed page. and then cache that. If a compressed page was requested but a non-compressed page is cached, the non-compressed page is served by squid. But if the compressed page is cached first, and a non compressed page cached, and then a compressed page requested, the compressed page will be served from cache.

I find squid will cache multiple encodings of a page only if and when a non-compressed page is not cached first/requested first, or else the non-compressed page will get cached, and since accept-encoding is conditional, there is no reason for squid to fetched a compressed page since the request will be okay with non-compressed encoding page.

#   TAG: cache_vary
#   When 'cache_vary' is set to off, response that have a
#   Vary header will not be stored in the cache.
#
#Default:
cache_vary on

cache_vary needs to be turned on, so that multiple encodings of a page is cached.