File extension caching

Richard Chiswell richard.chiswell at mangahigh.com
Wed Nov 25 16:17:29 CET 2009


Hi Andreas,

I believe:

if (req.url ~ "\.(jpg|jpg\?.*)$") {

should do it for you.

(The closest we've got in our working and testing Varnish configuration 
is ..."\.jpg\?([A-z0-9]+)$"...

Richard C.

Andreas Lehr wrote:
> Hi,
>
> Is it possible to use the extension caching mechanism of varnish to cache even rewrited jpegs like this URI scheme:
>
> http:/www.example.com/056.jpg?original
> http:/www.example.com/056.jpg?small
> http:/www.example.com/056.jpg?thumb
>
> Would this work like this?
> Or is another more sophisticated solution needed?
>
>
> sub vcl_recv {
>   if (req.url ~ "\.(jpg|jpg\?.)$") {
>      lookup;
>   }
> }
>
> # strip the cookie before the image is inserted into cache.
> sub vcl_fetch
>   if (req.url ~ "\.(jpg|jpg\?.)$") {
>     unset obj.http.set-cookie;
>
> }
>
> Thank you very much!
>
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc
>   




More information about the varnish-misc mailing list