in reply to Re: Re: Preventing an image from caching
in thread Preventing an image from caching

With CGI.pm, you can use the -expires switch to the header routine. Apparently, CGI::Util also has an expires routine that you can use to calculate the proper format. If you don't like digging around in the innards of CGI.pm, pull up HTTP::Date, which formats things according to the RFC. Something like this:
use HTTP::Date qw(time2str); my $now = time2str(time); print "Expires: $now\nLast-modified: $now\n"; # add other headers here

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: Re: Re: Preventing an image from caching
by andye (Curate) on Nov 28, 2000 at 15:45 UTC
    Setting Expires to 0 seems to work also; I think it's in the http/1.1 RFC (RFC 2068) somewhere as an OK thing to do.

    Also the following might be relevant:
    Pragma = no-cache (http/1.0)
    Cache-Control = no-cache (http/1.1)
    (bearing in mind that proxy servers in between you and your users might be http/1.0 or http/1.1, although the 1.1 ones should be backwards compatible, presumably)

    andy.