== Make Moin friendlier to caching proxies == We're using a mod_cache caching proxy in front of our Moin instance at [[http://www.apache.org/|the ASF]]. The following changes were made to make Moin more cache-friendly: * added correct Last-Modified header for page reads, to allow caching. * added correct Last-Modified header for the RecentChanges rss feed, using time of last edit. * added explicit Expires header for the RecentChanges rss feed, since some caches will not cache URLs containing a CGI-style query without it. This uses a new configuration setting, 'rss_cache', which specifies how long the page should be kept in cache. That setting defaults to 60 seconds, which seems a reasonable default. * added 'Vary: Accept-Language' header in the response, when the user agent has specified that header in the request. * added explicit cache-busting headers for actions that should not be cached, like page edits, user forms, or actions where caching is not important (like 'raw', 'print' etc.). * added cache-busting for logged-in users so that their personalisation settings can take effect. * replaces use of 'formatdate' with a new 'formathttpdate', since formatdate tends to create invalid strings using '-0000' instead of 'GMT' as mandated by the HTTP standard. [[attachment:MoinMoinPatch/moin-cache-friendly.diff]] is the diff, against current arch (patch 730). - added to moin 1.5 branch . But it seems to be [[http://hg.thinkmo.de/moin/1.5?cs=f0ef5aee12fb|removed]], because it had problems with dynamic content. -- TobiasPolzin <> -- JustinMason One more patch from the Apache install: Add "Vary: Cookie" on all pages to assure that logged-in users get the appropriate content. Note that while many of the above changes are simply enhancements to allow more-aggressive caching, the two additions to Vary (Cookie and Accept-Language) are necessary to assure the proper content is delivered regardless of the other changes. Without the Vary header, Moin will be broken by any shared cache living between the client and the server. (Also note that, technically, the two Vary headers should be merged into Vary: Cookie, Accept-Language, but servers should fold them together anyway.) [[attachment:MoinMoinPatch/vary-cookie.diff]] is the patch to be added to the above. - added to moin 1.5 branch -- JoshuaSlive /!\ See parent page for attachments! == Discussion == Docs on the whole matter: http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4 Comments: 1. Vary should include Cookie, Accept-Language and maybe User-Agent (reason: spider code) 1. All additional caching headers should maybe be limited to "normal" page views, since those cause the main load; such caution would limit side-effects of wrong header fields (what happens when Vary lies and we use other headers for content negotiation?) The cache-busting stuff does just that, according to its description. 1. As a precaution, if problem arise for a wiki admin due to caching somewhere he has no control over, maybe add a config value to prevent caching of ALL pages (add no-cache to any content sent).