Feature Proposal: Increase max-age for static webs


in Foswiki.pm we hardcode Cache-Control: max-age=0. This prevents the admin from over-riding it from apache frown, sad smile

In the use case I have, it would be reasonable to increase the max-age of the System web topics to at least a few minutes (The WebLeftBarWebList topic and other Sidebar dynamics being the most risky)

This then will allow us to use jqLoader to delay load the weblist - giving the impression of a faster wiki when there are lots of webs.

Description and Documentation

mostly I'd like to be able to

  • disable max-age setting from our scripts
  • increase the max-age for requests (non-url param requests) to topics in particular webs.





-- Contributors: SvenDowideit - 17 Apr 2012


I've implemented it, with things disabled by default, as you really do need to know what you're doing.

#---++ Browser Cache max-age
# Disable or change the HTTP Cache-Control header. Foswiki defaults to 
# =Cache-Control: max-age=0= which recomends to the browser that it should 
# ask foswiki if the topic has changed. If you have a web that does not change
# (like System), you can get the browser to use its cache by setting ={'System' => ''}=
# you can also set =max-age=28800= (for 8 hours), or any other of the 
# =Cache-Control= directives.
# <br />
# Setting the CacheControl to '' also allows you to manage this from your web 
# server (which will not over-ride the setting provided by the application), thus enabling
# web server based caching policies. When the user receives a browser-cache topic, 
# they can force a refresh using ctrl-r
# <br />
# this hash must be explicitly set per web or sub-web.
$Foswiki::cfg{BrowserCacheControl} = {};

however, while it works on my test system, its not working on http://trunk.foswiki.org/System - so it would be good to know why.

-- SvenDowideit - 10 Oct 2012
Topic revision: r3 - 05 Jul 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy