Skip to content

Instantly share code, notes, and snippets.

@ismasan
Created January 27, 2011 18:30
Show Gist options
  • Save ismasan/798947 to your computer and use it in GitHub Desktop.
Save ismasan/798947 to your computer and use it in GitHub Desktop.
Varnish VCL example for purging wildcard URLs
# This goes in vcl_recv
# It gives you:
# curl -X PURGE http://some.example.com/.*
# curl -X PURGE http://some.example.com/blog/.*
# curl -X PURGE http://some.example.com/blog/2011/bar.html
# curl -X PURGE http://another.example.com/.*
#
if (req.request == "PURGE") {
# Wildcard, per-domain purging
purge("req.http.host == " req.http.host " && req.url ~ " req.url "$");
error 200 "Purged.";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment