--- /dev/null
+#-e This is a basic VCL configuration file for varnish. See the vcl(7)
+#man page for details on VCL syntax and semantics.
+vcl 4.0;
+
+backend default {
+ .host = "127.0.0.1";
+ .port = "80";
+}
+
+# weasel's rule:
+sub vcl_recv {
+ if (req.http.Cache-Control ~ "(?i)no-cache") {
+ # Ignore requests via proxy caches and badly behaved crawlers
+ if (! (req.http.Via || req.http.User-Agent ~ "(?i)bot" || req.http.X-Purge)) {
+ return(purge); # Couple this with restart in vcl_purge and X-Purge header to avoid loops
+ }
+ }
+}
+
+sub vcl_purge {
+ # Only handle actual PURGE HTTP methods, everything else is discarded
+ if (req.method != "PURGE") {
+ # restart request
+ set req.http.X-Purge = "Yes";
+ return(restart);
+ }
+}