[Home]WikiPatches/PageCacheBugFix

UseModWiki | WikiPatches | RecentChanges | Preferences

I think http://www.mnot.net/cache_docs/ is a good document on the issue.

I installed UseModWiki at our site, and run into this problem immediately. Since our users use maybe all the possible browsers ranging from lynx to Opera to IE to anything else, I had to find a solution.

--- usemod092/wiki.pl   Sun Apr 22 00:44:10 2001
+++ wiki.cgi    Sun Apr 29 00:01:57 2001
@@ -973,6 +973,8 @@
 sub GetHttpHeader {
   my $cookie;
+  my $now;
+  $now = gmtime;
   if (defined($SetCookie{'id'})) {
     $cookie = "$CookieName="
             . "rev&" . $SetCookie{'rev'}
@@ -981,12 +983,20 @@
     $cookie .= ";expires=Fri, 08-Sep-2010 19:48:23 GMT";
     if ($HttpCharset ne '') {
       return $q->header(-cookie=>$cookie,
+                        -pragma=>"no-cache",
+                        -cache_control=>"no-cache",
+                        -last_modified=>"$now",
+                        -expires=>"+10s",
                         -type=>"text/html; charset=$HttpCharset");
     }
     return $q->header(-cookie=>$cookie);
   }
   if ($HttpCharset ne '') {
-    return $q->header(-type=>"text/html; charset=$HttpCharset");
+    return $q->header(-type=>"text/html; charset=$HttpCharset",
+                      -pragma=>"no-cache",
+                      -cache_control=>"no-cache",
+                      -last_modified=>"$now",
+                      -expires=>"+10s");
   }
   return $q->header();
 }



Interesting - have just done some similar header hacking (only HTTP/1.0 at present) for TWiki, over on TWiki:Codev/BackFromPreviewLosesText? - this is intended to ensure that the Edit page gets cached by IE5, because TWiki has a Preview page from which it's common to hit the browser's Back button. There are a lot of links about cache-friendliness on a page linked from that one. --RichardDonkin


NextRelease


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited November 12, 2007 12:51 am by MarkusLude (diff)
Search: