caching and hiding 302 redirects

Stroomer, Jeff Jeff.Stroomer at
Thu Sep 8 00:49:17 CEST 2011

From: Stroomer, Jeff
Sent: Wednesday, September 07, 2011 2:57 PM
To: 'Rob S'; 'varnish-misc at'
Subject: RE: caching and hiding 302 redirects

From: varnish-misc-bounces at<mailto:varnish-misc-bounces at> [mailto:varnish-misc-bounces at]<mailto:[mailto:varnish-misc-bounces at]> On Behalf Of Rob S
Sent: Wednesday, September 07, 2011 1:51 PM
To: varnish-misc at<mailto:varnish-misc at>
Subject: Re: caching and hiding 302 redirects

On 07/09/2011 20:41, Stroomer, Jeff wrote:
Varnish folks,

I’m trying to combine Varnish with a Tomcat  servlet  to make a fancy reverse proxy.  The idea is that Varnish forwards a URL to the servlet, which uses a 302 redirect to tell Varnish what the “real” URL should be.  For this to work well I need Varnish to do two things: 1) cache the 302 redirects from the servlet, and also 2) hide the redirect from the client.  It seems like I can get  Varnish to do one or the other, but not both simultaneously.
  Any suggestions as to how I can cache the 302 response and also hide the redirect from the client?



Take a look at - this suggests putting a restart in vcl_deliver.



Thanks, this seems like exactly what I need … but I tried it, and my 302 redirects are still not getting cached.  Here’s what I have in my default.vcl:



Rob, et al.,
Correction – I must have made a mistake earlier.  When I try the solution outlined in, it looks like things fall apart (browser gets empty response).  The problem seems to be doing the deliver at the end of my vcl_fetch.
Is it possible that my copy of Varnish is too old to include the fix for ticket #411?  I’m running the 2.1.3 version of varnish (which is what I got as the default when I did an apt-get in Ubuntu 10.10).  I see that the fix for #411 dates back to October of 2010, so now I’m thinking maybe I need to upgrade to a newer copy of varnish.  Does that sound plausible?  If I do upgrade, what’s the best way – build from source?

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

More information about the varnish-misc mailing list