3

Varnish has the possibility to strip certain cookies from the request before deciding if a request is non-cachable because it contains cookies. Is there such a thing for Apache's mod_cache?

Consider this situation: Apache 2.2 is a reverse proxy with lots of configuration (multiple VirtualHosts, 4 backend servers, authentication based on Host and path) that I really like - because it works.

Now to speed up delivery of a Django site, I would like to cache all requests to a certain VirtualHost - except those that carry the Django session cookie (e.g. logged in staff requests). Now the request obviously Varys with cookies, e.g. a logged in user with cookie is always given a freshly rendered page while someone without cookies is given a cached response.

So Vary: cookie would be the correct cache control header to do exactly that: Always freshly render when cookies present. BUT then there is Google Analytics (GA) (and other cookie-based tracking mechanisms like eTracker) that always sets a cookie.

Can Apache ignore that GA-cookie and Vary on the Django session cookie??

Paul
  • 1,890
  • 3
  • 18
  • 24

1 Answers1

1

As far as I can say (from my own personal tests) mod_cache in Apache 2.2.3 does not Vary with any cookie. It ends up serving anonymous-like pages to logged in users because ignores their cookie.

Andrei
  • 11
  • 1