X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Ftemplates%2Fsnapshot%2Fsnapshot.debian.org.vcl.erb;fp=modules%2Froles%2Ftemplates%2Fsnapshot%2Fsnapshot.debian.org.vcl.erb;h=25e6d1275e0da35e679d5613cca121c2e67feb66;hb=76ca91bce24ecbcbcc4e62a37aa06fd0fb9f96c7;hp=0000000000000000000000000000000000000000;hpb=46cee04ab06b23ab6e9e4baba655cf470d10cfc4;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/templates/snapshot/snapshot.debian.org.vcl.erb b/modules/roles/templates/snapshot/snapshot.debian.org.vcl.erb new file mode 100644 index 000000000..25e6d1275 --- /dev/null +++ b/modules/roles/templates/snapshot/snapshot.debian.org.vcl.erb @@ -0,0 +1,27 @@ +#-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); + } +}