Skip to content

Instantly share code, notes, and snippets.

@congdonglinux
Forked from fliphess/multiple domains.php
Created December 14, 2016 10:10
Show Gist options
  • Save congdonglinux/b769d71ddd1f495d6183bd9338d99834 to your computer and use it in GitHub Desktop.
Save congdonglinux/b769d71ddd1f495d6183bd9338d99834 to your computer and use it in GitHub Desktop.
byte flush varnish when on a varnish cluster
<?php
header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1
$domains = array('devguppie.com', 'wwww.devguppie.com', 'www.example.com', 'example.com');
foreach ($domains as $domain) {
$curl = curl_init("http://$domain/.*");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PURGE");
curl_exec($curl);
curl_close($curl);
}
?>
<?php
header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1
$domain = basename(dirname(realpath(__FILE__)));
$curl = curl_init("http://$domain/.*");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PURGE");
curl_exec($curl);
curl_close($curl);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment