I have a web page which shows a list of images. Users can click on a link next to each image to rotate them either left or right. The page is refreshed and the images re-displayed

The problem is, the images are being cached, so the previous orientation is being shown. I have tried setting the headers using CGI::Application as following (slightly modified from overkill anti-caching CGI headers):

# Set a last-modified date a little in the future to handle # local workstation times being slightly out. Is that valid? my $date = DateCalc('today', '+ 5 minutes'); $date = Date_ConvTZ($date, "", "GMT"); $self->header_add( -expires => 'Sat, 26 Jul 1997 05:00:00 GMT', -Last_Modified => UnixDate($date, '%a, %d %b %Y %H:%M:%S GMT') +, # HTTP/1.0 -Pragma => 'no-cache', # HTTP/1.1 -Cache_Control => join(', ', qw( no-store no-cache must-revalidate proxy-revalidate post-check=0 pre-check=0 max-age=0 s-maxage=0 )), );

An example of the produced header:

Date: Tue, 27 Mar 2007 03:52:20 GMT Server: Apache/1.3.34 (Unix) mod_fastcgi/2.4.2 PHP/5.0.5 Expires: Sat, 26 Jul 1997 05:00:00 GMT Pragma: no-cache Last-Modified: Tue, 27 Mar 2007 03:52:20 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre- +check=0 Keep-Alive: timeout=15, max=89 Connection: Keep-Alive Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked 200 OK

This seems to work intermittently in Firefox on both Windows and Linux, and slightly less often in MSIE v6. Any ideas appreciated


In reply to Slightly OT: Stop caching images by astroboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.