Skip to content

Instantly share code, notes, and snippets.

@fliphess
Last active December 14, 2016 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fliphess/8280d627b73fc111e2d2 to your computer and use it in GitHub Desktop.
Save fliphess/8280d627b73fc111e2d2 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