Update config for IE9 fonts and english only locales
[ckanext-datagovau.git] / admin / default.vcl
CKAN data.gov.au 1 # This is a basic VCL configuration file for varnish. See the vcl(7)
2 # man page for details on VCL syntax and semantics.
3 #
4 # Default backend definition. Set this to point to your content
5 # server.
6 #
7 backend default {
8 .host = "127.0.0.1";
9 .port = "8080";
10 }
11
12 sub vcl_fetch {
13 set beresp.grace = 1h;
14
15 if (beresp.http.content-type ~ "(text|application)") {
16 set beresp.do_gzip = true;
17 }
18 if (req.url ~ "\.(png|gif|jpg|jpeg|swf|css|js|woff|eot)$") {
19 unset beresp.http.set-cookie;
20 }
21 }
22 sub vcl_recv {
23 if (req.url ~ "^/_tracking") {
24 return (pass);
25 }
26 if (req.url ~ "\.(png|gif|jpg|jpeg|swf|css|js|woff|eot)$") {
27 return(lookup);
28 }
CKAN data.gov.au 29 if (req.url ~ "/(..|.._..)/") {
30 set req.url = regsub(req.url, "/((?!js)..|.._..)/", "/");
31 }
CKAN data.gov.au 32 if (req.http.Cookie) {
33 set req.http.Cookie = regsuball(req.http.Cookie, "(^|; ) *__utm.=[^;]+;? *", "\1"); # removes all cookies named __utm? (utma, utmb...) - tracking thing
34
35 if (req.http.Cookie == "") {
36 remove req.http.Cookie;
37 }
38 }
39 }
CKAN data.gov.au 40 sub vcl_hash {
41 # http://serverfault.com/questions/112531/ignoring-get-parameters-in-varnish-vcl
CKAN data.gov.au 42 set req.url = regsub(req.url, "(?:(.com|.au))/((?!js)..|.._..)/", "/");
CKAN data.gov.au 43 hash_data(req.url);
44 if (req.http.host) {
45 hash_data(req.http.host);
46 } else {
47 hash_data(server.ip);
48 }
49 return (hash);
50 }
CKAN data.gov.au 51 sub vcl_deliver {
52 if (!resp.http.Vary) {
53 set resp.http.Vary = "Accept-Encoding";
54 } else if (resp.http.Vary !~ "(?i)Accept-Encoding") {
55 set resp.http.Vary = resp.http.Vary + ",Accept-Encoding";
56 }
57 if (obj.hits > 0) {
58 set resp.http.X-Cache = "HIT";
59 } else {
60 set resp.http.X-Cache = "MISS";
61 }
62 }
63
64 #
65 # Below is a commented-out copy of the default VCL logic. If you
66 # redefine any of these subroutines, the built-in logic will be
67 # appended to your code.
68 # sub vcl_recv {
69 # if (req.restarts == 0) {
70 # if (req.http.x-forwarded-for) {
71 # set req.http.X-Forwarded-For =
72 # req.http.X-Forwarded-For + ", " + client.ip;
73 # } else {
74 # set req.http.X-Forwarded-For = client.ip;
75 # }
76 # }
77 # if (req.request != "GET" &&
78 # req.request != "HEAD" &&
79 # req.request != "PUT" &&
80 # req.request != "POST" &&
81 # req.request != "TRACE" &&
82 # req.request != "OPTIONS" &&
83 # req.request != "DELETE") {
84 # /* Non-RFC2616 or CONNECT which is weird. */
85 # return (pipe);
86 # }
87 # if (req.request != "GET" && req.request != "HEAD") {
88 # /* We only deal with GET and HEAD by default */
89 # return (pass);
90 # }
91 # if (req.http.Authorization || req.http.Cookie) {
92 # /* Not cacheable by default */
93 # return (pass);
94 # }
95 # return (lookup);
96 # }
97 #
98 # sub vcl_pipe {
99 # # Note that only the first request to the backend will have
100 # # X-Forwarded-For set. If you use X-Forwarded-For and want to
101 # # have it set for all requests, make sure to have:
102 # # set bereq.http.connection = "close";
103 # # here. It is not set by default as it might break some broken web
104 # # applications, like IIS with NTLM authentication.
105 # return (pipe);
106 # }
107 #
108 # sub vcl_pass {
109 # return (pass);
110 # }
111 #
112 # sub vcl_hash {
113 # hash_data(req.url);
114 # if (req.http.host) {
115 # hash_data(req.http.host);
116 # } else {
117 # hash_data(server.ip);
118 # }
119 # return (hash);
120 # }
121 #
122 # sub vcl_hit {
123 # return (deliver);
124 # }
125 #
126 # sub vcl_miss {
127 # return (fetch);
128 # }
129 #
130 # sub vcl_fetch {
131 # if (beresp.ttl <= 0s ||
132 # beresp.http.Set-Cookie ||
133 # beresp.http.Vary == "*") {
134 # /*
135 # * Mark as "Hit-For-Pass" for the next 2 minutes
136 # */
137 # set beresp.ttl = 120 s;
138 # return (hit_for_pass);
139 # }
140 # return (deliver);
141 # }
142 #
143 # sub vcl_deliver {
144 # return (deliver);
145 # }
146 #
147 # sub vcl_error {
148 # set obj.http.Content-Type = "text/html; charset=utf-8";
149 # set obj.http.Retry-After = "5";
150 # synthetic {"
151 # <?xml version="1.0" encoding="utf-8"?>
152 # <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
153 # "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
154 # <html>
155 # <head>
156 # <title>"} + obj.status + " " + obj.response + {"</title>
157 # </head>
158 # <body>
159 # <h1>Error "} + obj.status + " " + obj.response + {"</h1>
160 # <p>"} + obj.response + {"</p>
161 # <h3>Guru Meditation:</h3>
162 # <p>XID: "} + req.xid + {"</p>
163 # <hr>
164 # <p>Varnish cache server</p>
165 # </body>
166 # </html>
167 # "};
168 # return (deliver);
169 # }
170 #
171 # sub vcl_init {
172 # return (ok);
173 # }
174 #
175 # sub vcl_fini {
176 # return (ok);
177 # }
178