Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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