http://qs321.pair.com?node_id=124144

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

Hi.

What is the header that should go along with print "Content-type: text/html\n\n"; that will force the browser to cache the html outputted by a cgi script?

Thanks,
Ralph.

Replies are listed 'Best First'.
Re: Cache Output HTML
by Asim (Hermit) on Nov 08, 2001 at 23:47 UTC

    As a rule, you can recommend, not force, a browser to cache, or not cache, a page. Most browsers will listen to the "Expires" Header:
    Expires: Fri, 30 Oct 1998 14:19:41 GMT
    And the more recent (HTTP 1.1) "Cache-Control" Header:
    Cache-Control: max-age=3600, must-revalidate
    To sort these things out. Check out How (and how not) to Control Caches for more on this.

    ----Asim, known to some as Woodrow.