perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Prime <>
Subject Re: Redirects and Cache-Control
Date Thu, 09 Apr 2009 19:16:06 GMT
Justin Wyllie wrote:
> Hi
> I am trying to use:
> $headers = $r->headers_out;
> $r->no_cache(1);
> $headers->set( Location => url  );
> return REDIRECT.
> The first problem is this does not set the Cache-Control header.
> If instead of the redirect I output some content (200 ) then it does, 
> correctly.
> Is there some reason why this may be? I couldn't see anything in our 
> Apache configuration  files where this is set up.

No idea.  Does it set the Pragma header, but not the Cache-Control one?

> Second question:
> Does it make sense to try to set Cache-Control with a redirect anyway?

To my mind, no.  There's no content to cache, and normally (IIRC) if a 
browser is sent a 302, it'll request it again if you request it again. 
With a 301, some browsers will cache the fact that that URL 301'd 
before, and just take you right to the page you 301'd to.

> If url1 is requested and the redirect is to url2. What is the 
> browser/proxy being told not to cache - url1 or url2? Since it is url2 
> in the response headers surely url2?

I have no idea what the spec would be, but if you 302 with a 
Cache-Control header to a page that doesn't have a Cache-Control header, 
I would not expect (or want) the header from the 302 to apply to the 
other page.


View raw message