Mohamed Magdy wrote:
I was trying varnish cache but found that problem:
The url changes and the backend port is appended to the url which makes mw not use the varnish cache.. so instead of http://mw.wiki/wikistuff , it changes to http://mw.wiki:backendport/wikistuff ..which gives errors of course.. so is there a way to make mediawiki stick to the url without that port (port 80 only)?
MediaWiki detects the protocol, hostname, and port as given to it by the web server and uses those by default when constructing full URLs back to itself.
In a situation where you've got a front-end proxy between the server and the outside world, that can indeed give you the backend's configuration. You'll want to override the autodetected settings like this:
$wgServer = 'http://mw.wiki';
Note that in default configuration, the proxy cache will probably still be hitting the backend web server to check for updates to wiki pages. For best results you may need to configure 'squid mode', which will allow the proxy to cache anonymous page views, with explicit cache purge notifications sent when the pages change. I haven't tested myself to confirm that this works properly with Varnish, though.
See http://meta.wikimedia.org/wiki/Squid_caching for further docs.
-- brion vibber (brion @ wikimedia.org)