-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefault.vcl
More file actions
46 lines (38 loc) · 1.14 KB
/
default.vcl
File metadata and controls
46 lines (38 loc) · 1.14 KB
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
vcl 4.0;
import headerproxy;
backend default {
.host = "127.0.0.1";
.port = "8000";
}
sub vcl_recv {
if (req.method != "GET" &&
req.method != "HEAD" &&
req.method != "PUT" &&
req.method != "POST" &&
req.method != "TRACE" &&
req.method != "OPTIONS" &&
req.method != "DELETE") {
/* Non-RFC2616 or CONNECT which is weird. */
return (pipe);
}
if (req.method != "GET" && req.method != "HEAD") {
/* We only deal with GET and HEAD by default */
return (pass);
}
# Call our headerproxy script. Notice we choose not to send requests for
# asset files to the headerproxy.
if (req.url !~ "\.(gif|jpg|png|css|js)(\?|$)") {
# Make proxy call and add the desired request headers from your
# vcl_recv json key.
headerproxy.call(req.backend_hint, "/headerproxy.php");
if (headerproxy.error()) {
set req.http.X-HeaderProxy-Error = headerproxy.error();
}
}
return (hash);
}
sub vcl_deliver {
# This call adds the desired response headers from your vcl_deliver
# json key.
headerproxy.process();
}