1

Can Squid automatically add ETag based on page content, for the client not to download the same page twice?

porton
  • 312
  • 1
  • 14
  • 1
    I'd hope not, given that `ETag` is an origin server header, not a proxy header. – womble May 05 '19 at 22:49
  • @womble What do you have against the idea that a proxy should add `ETag` based on a hash of the page/headers content? – porton May 06 '19 at 06:37
  • Because it's not how ETags are specified to work, and hence assumptions baked into *every* other piece of software about how ETags are supposed to work will be invalidated. It's a bit like asking what I have against the idea that everyone should drive on the same side of the road. – womble May 06 '19 at 06:45
  • @womble I don't understand what _exactly_ my idea contradicts in the `ETag` specs. Please explain what exactly is wrong in automatically calculating `ETag` based on the page content and other headers. – porton May 06 '19 at 10:03

1 Answers1

1

Since Squid is, as far as I know, standards compliant Squid can't add Etag's.

RFC 2616 13.5.2 states:

A transparent proxy MUST NOT modify any of the following fields in a request or response, and it MUST NOT add any of these fields if not already present:

  • Content-Location
  • Content-MD5
  • ETag
  • Last-Modified

You can recompile Squid with the --enable-http-violations option to enable some additional features that break standards, but even that won't do (out-of-the-box) what you want.

The additional features such as reply_header_access, request_header_access and reply_header_replace resp. request_header_replace will only provide a method to modify headers with static pre-defined string, not calculated dynamic ones.

HBruijn
  • 72,524
  • 21
  • 127
  • 192