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??


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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.