1 # Example VCL for Varnish 4.0 with public-inbox WWW code
2 # This is based on what shipped for 3.x a long time ago (I think)
3 # and I'm hardly an expert in VCL (nor should we expect anybody
4 # who maintains a public-inbox HTTP interface to be).
6 # It seems to work for providing some protection from traffic
7 # bursts; but perhaps the public-inbox WWW interface can someday
8 # provide enough out-of-the-box performance that configuration
9 # of an extra component is pointless.
18 if (req.method != "GET" &&
19 req.method != "HEAD" &&
20 req.method != "PUT" &&
21 req.method != "POST" &&
22 req.method != "TRACE" &&
23 req.method != "OPTIONS" &&
24 req.method != "DELETE") {
25 /* Non-RFC2616 or CONNECT which is weird. */
28 if (req.method != "GET" && req.method != "HEAD") {
29 /* We only deal with GET and HEAD by default */
32 if (req.http.Authorization || req.http.Cookie) {
33 /* Not cacheable by default */
42 hash_data(req.http.host);
46 if (req.http.X-Forwarded-Proto) {
47 hash_data(req.http.X-Forwarded-Proto);
52 sub vcl_backend_response {
53 set beresp.grace = 60s;
54 set beresp.do_stream = true;
55 if (beresp.ttl <= 0s ||
56 beresp.http.Set-Cookie ||
57 beresp.http.Vary == "*") {
58 /* Mark as "Hit-For-Pass" for the next 2 minutes */
59 set beresp.ttl = 120 s;
60 set beresp.uncacheable = true;