Hi.
Varnish cache PURGE does not work since Varnish 2.x. It seems like Varnish will not any more accept the MediaWiki format (according to http://www.mediawiki.org/wiki/Manual:Varnish_caching):
PURGE http://domain.com/url HTTP/1.0
But it will rather want a compliant request such as:
PURGE /url HTTP/1.0 Host: domain.com
I have modified the SquidPurgeClient.php to reflect the following:
public function queuePurge( $url ) {
$url = str_replace( "\n", , $url ); $urlArr = parse_url($url); if($urlArr['query'] != "") $urlQuery = "?" . $urlArr['query']; else $urlQuery = ""; $this->requests[] = "PURGE " . $urlArr['path'] . $urlQuery . " HTTP/1.0\r\n" . "Host: " . $urlArr['host'] . "\r\n" . "Connection: Keep-Alive\r\n" . "Proxy-Connection: Keep-Alive\r\n" . "User-Agent: " . Http::userAgent() . ' ' . __CLASS__ . "\r\n\r\n"; if ( $this->currentRequestIndex === null ) { $this->nextRequest(); }
}
Which seems to successfully PURGE pages with Varnish 2.x and 3.x.
In addition I have done the following to the VCL to purge both entries for www.domain.com and domain.com:
if (req.request == "PURGE") {
if (client.ip != "....<edited>....") { error 405 "Not allowed."; } purge("req.url == " req.url " && req.http.host ~ ^(www.)?" regsub(req.http.host, "www\.(.*)", "\1")); error 200 "Purged.";
}
Yours,
Mikael