-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathwordpress.vcl
52 lines (44 loc) · 1010 Bytes
/
wordpress.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
backend default {
.host = "127.0.0.1";
.port = "8080";
}
acl purge {
"localhost";
}
sub vcl_recv {
if (req.request == "BAN") {
if(!client.ip ~ purge) {
error 405 "Not allowed.";
}
ban("req.url ~ "+req.url+" && req.http.host == "+req.http.host);
error 200 "Banned.";
}
if (req.request != "GET" &&
req.request != "HEAD" &&
req.request != "PUT" &&
req.request != "POST" &&
req.request != "TRACE" &&
req.request != "OPTIONS" &&
req.request != "DELETE") {
return (pipe);
}
if (req.request != "GET" && req.request != "HEAD") {
return (pass);
}
if (req.url ~ "wp-(login|admin)" || req.url ~ "preview=true") {
return (pass);
}
remove req.http.cookie;
return (lookup);
}
sub vcl_fetch {
if (beresp.status == 404) {
set beresp.ttl = 0m;
return(hit_for_pass);
}
if (req.url ~ "wp-(login|admin)" || req.url ~ "preview=true") {
return (hit_for_pass);
}
set beresp.ttl = 24h;
return (deliver);
}