## Called when a client request is received
#
#sub vcl_recv {
-# if (req.request != "GET" && req.request != "HEAD") {
-# pipe;
-# }
-# if (req.http.Expect) {
-# pipe;
-# }
-# if (req.http.Authenticate || req.http.Cookie) {
-# pass;
-# }
-# lookup;
+# if (req.request != "GET" &&
+# req.request != "HEAD" &&
+# req.request != "PUT" &&
+# req.request != "POST" &&
+# req.request != "TRACE" &&
+# req.request != "OPTIONS" &&
+# req.request != "DELETE") {
+# pipe;
+# }
+# if (req.http.Expect) {
+# pipe;
+# }
+# if (req.request != "GET" && req.request != "HEAD") {
+# pass;
+# }
+# if (req.http.Authorization || req.http.Cookie) {
+# pass;
+# }
+# lookup;
#}
#
## Called when entering pipe mode
## Called when entering an object into the cache
#
#sub vcl_hash {
-# set req.hash += req.url;
-# set req.hash += req.http.host;
-# hash;
+# set req.hash += req.url;
+# if (req.http.host) {
+# set req.hash += req.http.host;
+# } else {
+# set req.hash += server.ip;
+# }
+# hash;
#}
#
## Called when the requested object was found in the cache
## backend, or the request to the backend has failed
#
#sub vcl_fetch {
-# if (!obj.valid) {
-# error;
-# }
-# if (!obj.cacheable) {
-# pass;
-# }
-# if (obj.http.Set-Cookie) {
-# pass;
-# }
-# insert;
+# if (!obj.valid) {
+# error obj.status;
+# }
+# if (!obj.cacheable) {
+# pass;
+# }
+# if (obj.http.Set-Cookie) {
+# pass;
+# }
+# set obj.prefetch = -30s; insert;
#}
#
-#
## Called before a cached object is delivered to the client
#
#sub vcl_deliver {
# discard;
#}
#
-## Called when an object is about to be discarded
+# Called when an object is about to be discarded
#
#sub vcl_discard {
# discard;
}
sub vcl_recv {
- if (req.request != "GET" && req.request != "HEAD") {
+ if (req.request != "GET" &&
+ req.request != "HEAD" &&
+ req.request != "PUT" &&
+ req.request != "POST" &&
+ req.request != "TRACE" &&
+ req.request != "OPTIONS" &&
+ req.request != "DELETE") {
pipe;
}
if (req.http.Expect) {
pipe;
}
- if (req.http.Authenticate || req.http.Cookie) {
+ if (req.request != "GET" && req.request != "HEAD") {
+ pass;
+ }
+ if (req.http.Authorization || req.http.Cookie) {
pass;
}
lookup;
sub vcl_hash {
set req.hash += req.url;
- set req.hash += req.http.host;
+ if (req.http.host) {
+ set req.hash += req.http.host;
+ } else {
+ set req.hash += server.ip;
+ }
hash;
}
sub vcl_fetch {
if (!obj.valid) {
- error;
+ error obj.status;
}
if (!obj.cacheable) {
pass;
if (obj.http.Set-Cookie) {
pass;
}
- insert;
+ set obj.prefetch = -30s; insert;
}
sub vcl_deliver {
deliver;
}
-sub vcl_timeout {
+sub vcl_discard {
discard;
}
-sub vcl_discard {
+sub vcl_timeout {
discard;
}
.Ed