Caching images only

spaceman spaceman at antispaceman.com
Wed Nov 6 01:00:19 CET 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Assuming cookies are the reason it is failing to cache, this should
solve the problem:
if (req.url ~ "\.(png|gif|jpg|jpeg|bmp)(\?.*|)$"){
             remove req.http.Cookie;
}
Your if statement doesn't apply if there are get parameters on the end
of it, hence it doesn't remove the cookie and misses. 

Regards,
spaceman

On 15:11 04/11/2013, Kumar Shantanu wrote:
> 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
> >http://test.demo.co.uk/web/demo/home?p_p_id=propertyslider_WAR_propertysliderportlet&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_cacheability=cacheLevelPage&p_p_col_id=column-1&p_p_col_count=1&_propertyslider_WAR_propertysliderportlet_img-name=*152.jpeg*&_propertyslider_WAR_propertysliderportlet_img-height=400&_propertyslider_WAR_propertysliderportlet_img-width=960
> 
> Any idea on how to achieve this. I tried using reqex to match url
> but failed :(
> 
> 
> Thanks
> Shantanu
> 
> 
> 

> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> 
> !DSPAM:5277789736183523517242!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBAgAGBQJSeYaTAAoJELI7LCoggkTZHvcIAJPTOt7MghJGVue4DRDbB0HM
WZXftVr7YemuLIgUT5Zaqb2FJrYuFKpVE16APpEKpt/I3Y4MEpLkaSiNRf1TMgyj
CLqKMU23TpctFzOI9ID9GrA0hiXj+3HsQVlgp3X2jSpXLyQEwV/XG/WlQ61Rlr7A
JkfDYfviGtBAK+AUlt7K8fyFPfizSB8r0mZ/vaxd9p5g1i6EJjyk3+sxXss0UC06
V1Bm9gdiwPtIPMNGeBYut4IZ7paO4Ebbs285CkN6Q1gb9wI+Sdii/LqFJbZ7jMSM
/XxneIxpwZFqD4bsGPoYQkCLuf+j8zVVr89A3NmnXo56pJf64algbczgaMjHDL4=
=K8k7
-----END PGP SIGNATURE-----

!DSPAM:5279869436161097714120!





More information about the varnish-misc mailing list