SHOW:
|
|
- or go back to the newest paste.
1 | import std; | |
2 | ||
3 | backend default { | |
4 | .host = "87.98.200.165"; | |
5 | .port = "80"; | |
6 | } | |
7 | sub vcl_recv | |
8 | { | |
9 | std.syslog(1, "RECV: " + req.url); | |
10 | ||
11 | if( | |
12 | req.request != "GET" && | |
13 | req.request != "HEAD" | |
14 | ) | |
15 | { | |
16 | std.syslog(1, "RECV > RETURN PIPE: " + req.url); | |
17 | return (pipe); | |
18 | } | |
19 | ||
20 | std.syslog(1, "RECV > RETURN LOOKUP: " + req.url); | |
21 | ||
22 | # Lookup even if cookies! (we will decide whether to cache in vcl_fetch() based on X-Kigo-WS-Cache server header) | |
23 | return (lookup); | |
24 | } | |
25 | ||
26 | sub vcl_fetch | |
27 | { | |
28 | std.syslog(1, "FETCH: " + req.url); | |
29 | ||
30 | if( | |
31 | beresp.http.X-Kigo-WS-Cache == "Yes" && | |
32 | beresp.ttl > 0s && | |
33 | !beresp.http.Set-Cookie && | |
34 | beresp.http.Vary != "*" | |
35 | ) | |
36 | { | |
37 | std.syslog(1, "FETCH > RETURN DELIVER: " + req.url); | |
38 | return (deliver); | |
39 | } | |
40 | ||
41 | ||
42 | std.syslog(1, "FETCH > RETURN HIT_FOR_PASS: " + req.url); | |
43 | ||
44 | return (hit_for_pass); | |
45 | } |