sallinen varnish
[mirror/dsa-puppet.git] / modules / roles / templates / snapshot / snapshot.debian.org.vcl.erb
1 #-e This is a basic VCL configuration file for varnish.  See the vcl(7)
2 #man page for details on VCL syntax and semantics.
3 vcl 4.0;
4
5 backend default {
6  .host = "127.0.0.1";
7  .port = "80";
8 }
9
10 # weasel's rule:
11 sub vcl_recv {
12  if (req.http.Cache-Control ~ "(?i)no-cache") {
13    # Ignore requests via proxy caches and badly behaved crawlers
14    if (! (req.http.Via || req.http.User-Agent ~ "(?i)bot" || req.http.X-Purge)) {
15       return(purge); # Couple this with restart in vcl_purge and X-Purge header to avoid loops
16    }
17  }
18 }
19
20 sub vcl_purge {
21   # Only handle actual PURGE HTTP methods, everything else is discarded
22   if (req.method != "PURGE") {
23     # restart request
24     set req.http.X-Purge = "Yes";
25     return(restart);
26   }
27 }