http://www.perlmonks.org?node_id=3472

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

Script invoked with post method:
&lt;FORM METHOD="POST" ACTION="http://url/cgi-bin/search_engine.cgi"&g +t; with <INPUT TYPE="text" SIZE="30" NAME="keywords" MAXLENGTH="80">
Returns page of site urls.
  • Comment on Why does back-buttoning to a cgi script-output page yield 'Page expired'?
  • Download Code

Replies are listed 'Best First'.
Re: Why does back-buttoning to a cgi script-output page yield 'Page expired'?
by pschoonveld (Pilgrim) on Feb 15, 2000 at 00:59 UTC

    Most CGI scripts or their servers include a header that defines the page given from the CGI as a no-cache page. Couple that with a specific expiration date (generally a date that has already passed so that no-caching ever happens) and you have those issues.

    I believe the headers usually come from the cgi. But, sometimes the server will tack that on for cgi executions. So, depending on the lib you are using (if any), you should be able to change the CGI.

    There is one thing I don't understand. Somehow servers respond differently to SSI, PHP, mod_perl or CGI generated pages. Search engines will not cache these pages, even though no headers are specified. Ditto goes for browsers. I think certain servers might add some header crap-o in. I would like a little insight on this if anyone has a clue.

RE: Why does back-buttoning to a cgi script-output page yield 'Page expired'?
by Crulx (Monk) on Feb 15, 2000 at 03:29 UTC
    The post above is correct. To the best of my knowledge, most web browsers do not cash anything that is not an image or a web page by default unless you specify in the header negotiation otherwise. Most web servers do no header negotiation if it is not an html or a image. You'll have to put in the header negotiation yourself. Typically setting the expires tag works. If you are using CGI...
    print $query->header(-expires=>'+3d');
    If that doesn't force the caching, you'll have to use the Cache-Control header request specified here
    ---
    Crulx
    crulx@iaxs.net