Update VCL to something that ought to work with 4.0
[mirror/dsa-puppet.git] / modules / varnish / files / default.vcl
1 ##
2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
4 ##
5 vcl 4.0;
6
7 backend default {
8         .host = "127.0.0.1";
9         .port = "80";
10 }
11
12 sub vcl_recv {
13         set req.grace = 600s;
14 }
15
16 sub vcl_backend_response {
17 /*        if (beresp.status != 200 && beresp.status != 403 && beresp.status != 404 && beresp.status != 301 && beresp.status != 302) {
18                 return(restart);
19         }*/
20
21         # if I cant connect to the backend, ill set the grace period to be 600 seconds to hold onto content
22         set beresp.ttl = 600s;
23         set beresp.grace = 600s;
24
25         if (beresp.status >= 500) {
26                 set beresp.ttl = 0.1s;
27         }
28         unset beresp.http.Set-Cookie;
29 }
30
31
32 sub vcl_deliver {
33
34         set resp.http.X-Served-By = server.hostname;
35         if (obj.hits > 0) {
36                 set resp.http.X-Cache = "HIT";
37                 set resp.http.X-Cache-Hits = obj.hits;
38         } else {
39                 set resp.http.X-Cache = "MISS";
40         }
41
42         return(deliver);
43 }