Re: Avoiding Proxy Caching [message #174963 is a reply to message #174957] |
Wed, 27 July 2011 06:40 |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma:
|
Senior Member |
|
|
El 26/07/2011 17:35, j escribió/wrote:
> I'm having trouble with a proxy server caching pages. Is there a header
> or something that I can send to alleviate this problem?
>
> What I have is an htaccess rewrite rule
>
> RewriteRule ^(.*/protected_directory/.*) /pass_check_script.php?path=/$1
>
> that sends all requests for a directory to a php script that does some
> password checking and then reads the file and prints a Content-type and
> then prints the file contents. A proxy server has cached the results and
> avoids the pass check.
>
> I was thinking of sending something in the header, or perhaps just
> amending some random string to the html. I know proxy servers ignore
> html type no-cache settings.
I normally use something like this:
header('Expires: ' . gmdate('D, d M Y H:i:s', time()-86400*365*10) . '
GMT');
header('Cache-Control: no-store, no-cache, must-revalidate,
post-check=0, pre-check=0');
header('Pragma: no-cache');
If I recall correctly it's the "Pragma" header the one that's designed
for proxies but I'd say there's no need to cache the password checking
page not even in browsers.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
|
|
|