forked from dingproject/ding-deploy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ding.vcl
84 lines (70 loc) · 1.99 KB
/
ding.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
// added by johsw (http://drupal.org/user/58666) june 23rd 2010
// js
if (req.url ~ "\.(js)") {
lookup;
}
// images
if (req.url ~ "\.(gif|jpg|jpeg|bmp|png|tiff|tif|ico|img|tga|wmf)$") {
unset req.http.cookie;
lookup;
}
// ajax-callback (does not work due to timestamp)
if (req.url ~ "^/ting/autocomplete") {
unset req.http.cookie;
lookup;
}
if (req.url ~ "^/ting_search_carousel/results") {
unset req.http.cookie;
lookup;
}
//if (req.request != "GET" && req.request != "HEAD"){
//unset req.http.cookie;
//lookup;
//}
// end added by johsw
// Remove has_js and Google Analytics __* cookies.
set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+|has_js)=[^;]*", "");
// Remove a ";" prefix, if present.
set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");
// Remove Webtrends cookies.
set req.http.Cookie = regsub(req.http.Cookie, "(^|;\s*)(WT_FPC)[^;]*", "");
// Remove NO_CACHE cookies.
set req.http.Cookie = regsub(req.http.Cookie, "(^|;\s*)(NO_CACHE)[^;]*", "");
// Remove empty cookies.
if (req.http.Cookie ~ "^\s*$") {
unset req.http.Cookie;
}
// Cache all requests by default, overriding the
// standard Varnish behavior.
// if (req.request == "GET" || req.request == "HEAD") {
// return (lookup);
// }
}
//sub vcl_hash {
// if (req.http.Cookie) {
// set req.hash += req.http.Cookie;
// }
//}
sub vcl_fetch {
// added by johsw (http://drupal.org/user/58666) june 23rd 2010
if (req.url ~ "\.(gif|jpg|jpeg|bmp|png|tiff|tif|ico|img|tga|wmf)$") {
set obj.ttl = 600s;
set obj.http.type = "fetch image";
unset obj.http.set-cookie;
}
// ajax-callback
if (req.url ~ "^/ting/autocomplete") {
set obj.ttl = 600s;
unset obj.http.set-cookie;
}
if (req.url ~ "^/ting_search_carousel/results") {
set obj.ttl = 600s;
unset obj.http.set-cookie;
}
// end added by johsw
}