Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

http header / browser caching issues

by d_i_r_t_y (Monk)
on Aug 30, 2001 at 12:08 UTC ( [id://109016]=perlquestion: print w/replies, xml ) Need Help??

d_i_r_t_y has asked for the wisdom of the Perl Monks concerning the following question:

i'm currently having issues with browsers apparently caching the output of my cgi scripts, such that hitting 'back' or following a link to a script that has been called previously does not re-call the cgi script.

naturally, this often ends up with the old (and usually incorrect) information being shown.i have tried setting the http 'expires' header to 'now' and '-10d' (using the CGI::header method), and then verified the http headers by telnet'ing to port 80 and issuing manual http 1.1 GET's... all looks well - the expires header is there and set to the correct date/time etc...

one thing i've done which is perhaps a little unusual is that all my scripts do not have suffixes - they are simply named 'query', 'results' etc -- i have accordingly setup apache to execute as CGI anything in a particular directory (and kept all my library *.pm's elsewhere...).

can any web monk(-ey) provide any explanation or pointers as to why the silly browser (any browser) continues to cache the output of my cgi's?

d_i_r_t_y

Replies are listed 'Best First'.
Re: http header / browser caching issues
by echo (Pilgrim) on Aug 30, 2001 at 12:15 UTC
    Using the expires header is not always sufficient, if only because of clients that have their clock set wrong. I have had good results with the following headers, which is what the Apache API r->no_cache emits:
    Cache-Control: no-cache Pragma: no-cache
    in combination with the <code>expires now<code> header you already send out.
Re: http header / browser caching issues
by tachyon (Chancellor) on Aug 30, 2001 at 17:34 UTC
Re: http header / browser caching issues
by earthboundmisfit (Chaplain) on Aug 30, 2001 at 18:14 UTC
    The above info is all excellent. However, for anyone who needs a more basic explanation of document caching, I've found this resource to be of great value. Cache control: proxy-revalidate might apply to your situation.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://109016]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-28 16:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found