-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.vcl
52 lines (39 loc) · 850 Bytes
/
default.vcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
vcl 4.0;
import std;
probe elc_probe {
.window = 1;
.threshold = 1;
}
backend default {
.host = "app";
.port = "5000";
.probe = elc_probe;
}
backend failover {
.host = "failover";
.port = "80";
}
sub vcl_recv {
unset req.http.Cookie;
set req.backend_hint = failover;
if(std.healthy(default)) {
set req.http.X-Fetch = "1";
}
return (hash);
}
sub vcl_backend_response {
set beresp.ttl = 10s;
set beresp.grace = 6h;
if(beresp.http.X-Failover == "1") {
// send lower akamai edge cache control header
}
if (beresp.status == 500 || beresp.status == 502 || beresp.status == 503 || beresp.status == 504) {
return (abandon);
}
return (deliver);
}
sub vcl_hash {
# for testing only cache on path
hash_data(req.url);
return (lookup);
}