Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I'd like to set the TTL based on the current date. should have 5 days as TTL. should have 1 day as TTL.
Current Date: 15 April 2011

How is this possible in varnish?


share|improve this question

Varnish honors the cache-headers sent by the backend - so setting appropriate expires-timestamps on your backend would be the best way to solve it.

If that is not an option, you would need to either develop a vmod, or implement this in in-line C within the VCL.

Developing a VMod, or writing in-line C in VCL is probably outside the scope of Serverfault, and should be brought up at Stack Overflow.

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.