rename varnish to varnish_pkgmirror module
[mirror/dsa-puppet.git] / modules / varnish-pkgmirror / 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_backend_response {
13 /*        if (beresp.status != 200 && beresp.status != 403 && beresp.status != 404 && beresp.status != 301 && beresp.status != 302) {
14                 return(restart);
15         }*/
16
17         # if I cant connect to the backend, ill set the grace period to be 600 seconds to hold onto content
18         set beresp.ttl = 600s;
19         set beresp.grace = 600s;
20
21         if (beresp.status >= 500) {
22                 set beresp.ttl = 0.1s;
23         }
24         unset beresp.http.Set-Cookie;
25 }
26
27
28 sub vcl_deliver {
29
30         set resp.http.X-Served-By = server.hostname;
31         if (obj.hits > 0) {
32                 set resp.http.X-Cache = "HIT";
33                 set resp.http.X-Cache-Hits = obj.hits;
34         } else {
35                 set resp.http.X-Cache = "MISS";
36         }
37
38         return(deliver);
39 }