[Mediawiki-l] adapting MW caching behavior to the domain in the request?

Maarten maartenvd at gmail.com
Mon Sep 24 22:01:29 UTC 2007


Hi folks,

A question about MW caching of rendered pages.

I've got a wiki set up that's reachable under multiple domain names.
MW keeps only one version of each page in the cache and hands visitors
the cached copy regardless of what domain they come to. For baroque
reasons, this is causing problems.

Most pages in our wiki contain an instance of the Google Maps
extension. The Google Maps API requires that the javascript on your
page pass Google an UUID "API key" that was generated for the domain
that hosts the page. The extension code will look at the current
domain name and generate javascript to pass the right key.

However, that javascript code then becomes part of the HTML cached by
Mediawiki: One visitor fetches the page with a request to
wiki.domain1.com, and Mediawiki caches the resulting HTML. Next
visitor arrives with a request to wiki.domain2.com, Mediawiki sees it
has a cached copy, and hands that over--including the javascript with
key meant for domain1.com.

I'm curious what the best way is to work around this. I don't want to
turn off MW's page caching altogether.

Should I patch MediaWiki to consider a cached page invalid if it was
generated for a request to a different domain?
Would it work emit move some of the GMaps-related Javascript from the
skin code, or is HTML generated by the skin also cached?
Are there other ways to work around this?

Thanks!

Maarten.



More information about the MediaWiki-l mailing list