FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Avoiding Proxy Caching
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Avoiding Proxy Caching [message #174957] Tue, 26 July 2011 15:35 Go to next message
j is currently offline  j
Messages: 9
Registered: July 2011
Karma: 0
Junior Member
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.

Jeff
Re: Avoiding Proxy Caching [message #174958 is a reply to message #174957] Tue, 26 July 2011 17:58 Go to previous messageGo to next message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(j)

> I'm having trouble with a proxy server caching pages. Is there a
> header or something that I can send to alleviate this problem?

Caching Tutorial for Web Authors and Webmasters
http://www.mnot.net/cache_docs/

Micha

--
http://mfesser.de/blickwinkel
Re: Avoiding Proxy Caching [message #174959 is a reply to message #174958] Tue, 26 July 2011 19:02 Go to previous messageGo to next message
j is currently offline  j
Messages: 9
Registered: July 2011
Karma: 0
Junior Member
On 7/26/2011 1:58 PM, Michael Fesser wrote:
> .oO(j)
>
>> I'm having trouble with a proxy server caching pages. Is there a
>> header or something that I can send to alleviate this problem?
>
> Caching Tutorial for Web Authors and Webmasters
> http://www.mnot.net/cache_docs/
>
> Micha
>
Thanks! Looks like: header('Cache-Control: no-store');

Jeff
Re: Avoiding Proxy Caching [message #174963 is a reply to message #174957] Wed, 27 July 2011 06:40 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
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
--
Re: Avoiding Proxy Caching [message #174974 is a reply to message #174963] Thu, 28 July 2011 13:19 Go to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(Álvaro G. Vicario)

> 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.

The 'Pragma' header was defined as a request header. It were broken
browsers like old IE that turned it into a response header, but such a
meaning is not specified.

Micha

--
http://mfesser.de/blickwinkel
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: how to make a function recursive
Next Topic: PHP and Flash
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 03:46:03 GMT 2024

Total time taken to generate the page: 0.02969 seconds