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

I would like to setup Varnish to purge content in cache and get it directly from backend when CTRL+R or CTLR+F5 is pressed.

I use these rules but this only gets content from backend when CTRL+F5 is pressed. When I press F5 only I get data from cache.

acl CTRLF5 {

sub vcl_hit {

  if (client.ip ~ CTRLF5) {
    if (req.http.pragma ~ "no-cache" || req.http.Cache-Control ~ "no-cache")
      set obj.ttl = 0s;
    else { return(deliver); }
  else { return(deliver); }
share|improve this question
Which browser do you use for testing ? Could you post the request headers sent when you F5 a page ? – Jérôme R Feb 12 '12 at 16:56
up vote 2 down vote accepted

Can be realised with next statements:

varnish 2.1.x

    if (req.http.Cache-Control ~ "no-cache"){

varnish 3.x

    if (req.http.Cache-Control ~ "no-cache"){
share|improve this answer
Firefox 10.1 when pressing F5, but I will try your rules :) HTTP/1.1 304 Not Modified Content-Type: image/jpeg Etag: "2252232387" Last-Modified: Sun, 12 Feb 2012 18:00:59 GMT Accept-Ranges: bytes Date: Sun, 12 Feb 2012 18:11:31 GMT Connection: keep-alive X-Cache: HIT Cache-Control: private Pragma: private – Spacedust Feb 12 '12 at 18:11
It still doesn't work. Pressing F5 or CTLR+R gets content from cache. CTLR+F5 gets content from disk. – Spacedust Feb 12 '12 at 18:17
There is a nice config, but it do not work with Varnish 3.0: – Spacedust Feb 14 '12 at 16:15
Got it: – Spacedust Feb 14 '12 at 22:15

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.