Conditional GETs

Dag-Erling Smørgrav des at
Sun Jul 29 21:15:47 CEST 2007

Ricardo Newbery <ric at> writes:

> On Jul 29, 2007, at 3:52 AM, Dag-Erling Smørgrav wrote:
>> Ricardo Newbery <ric at> writes:
>>> What happens when a client sends a conditional request (either INM or
>>> IMS) and the content is not available in the Varnish cache?  I assume
>>> that Varnish will just relay the original conditional request through
>>> to the backend.
>> No, it will strip the conditional header before requesting the page
>> from
>> the backend.
> Okay, I think I understand.  So with Varnish in front, using the
> default VCL, there is no set of circumstances that will ever result
> in a conditional request to the backend.  Correct?


> But I can still change this behavior with a custom VCL.  Correct?

Yes, by editing bereq in vcl_miss.

> # perpetually refresh my cache
> vcl_timeout {
>         fetch;
> }

This probably won't, but it's on our list for 2.0.

> # if not available in cache, pass client's IMS to backend
> # and pass response back to client without caching
> vcl_miss {
>         if (req.http.If-Modified-Since) {
>                 pass;
>         }
> }

You probably don't want to do that.  It basically opens up a back door,
allowing anyone to bypass Varnish and hit your backend directly just by
including a bogus IMS in their request.

Dag-Erling Smørgrav
Senior Software Developer
Linpro AS -

More information about the varnish-misc mailing list