Caching images only

Γιάννης Καραγιαννίδης gkaragiannidis at
Mon Nov 4 13:21:45 CET 2013

You could always use

// remove cookie from these
if (req.http.Content-Type ~ "(image|audio|video|pdf|flash|text)") { remove req.http.Cookie; }

From: at [ at] On Behalf Of Kumar Shantanu
Sent: Monday, November 04, 2013 12:19 PM
To: varnish-misc at
Subject: Caching images only

Hello everybody,

I am trying to cache all images for my website and it's working fine with simple configuration as given below.

sub vcl_recv {
  if (req.url ~ "\.(png|gif|jpg|jpeg|bmp)$"){
        remove req.http.Cookie;

It's caching image url which is simply ending with filename.jpeg, but this can't cache if the url is bit complex like this

Any idea on how to achieve this. I tried using reqex to match url but failed :(

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list