Commit cb1a16fe authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

cleanup varnish configuration.

parent 1cea17da
...@@ -37,12 +37,10 @@ sub vcl_recv { ...@@ -37,12 +37,10 @@ sub vcl_recv {
} }
# Pass anything other than GET and HEAD directly. # Pass anything other than GET and HEAD directly.
if (req.request != "GET" && req.request != "HEAD") { if (req.request != "GET" && req.request != "HEAD") {
unset req.http.If-Modified-Since;
return (pass); return (pass);
} }
if (req.http.Authorization) { if (req.http.Authorization) {
/* Not cacheable by default */ /* Not cacheable by default */
unset req.http.If-Modified-Since;
return (pass); return (pass);
} }
...@@ -60,7 +58,6 @@ sub vcl_recv { ...@@ -60,7 +58,6 @@ sub vcl_recv {
unset req.http.Cookie; unset req.http.Cookie;
} }
if (req.http.Cookie && req.http.Cookie ~ "(^|; ) *__ac=") { if (req.http.Cookie && req.http.Cookie ~ "(^|; ) *__ac=") {
unset req.http.If-Modified-Since;
return (pass); return (pass);
} }
...@@ -75,6 +72,14 @@ sub vcl_recv { ...@@ -75,6 +72,14 @@ sub vcl_recv {
return (lookup); return (lookup);
} }
# Run after a pass in vcl_recv OR after a lookup that returned a hitpass
sub vcl_pass {
# unset If-Modified-Since to avoid reusing anonymous's browser cache
# after login.
unset req.http.If-Modified-Since;
return (pass);
}
# Creates the varnish cache key by the url # Creates the varnish cache key by the url
sub vcl_hash { sub vcl_hash {
# We use url only for hash. # We use url only for hash.
...@@ -97,7 +102,7 @@ sub vcl_fetch { ...@@ -97,7 +102,7 @@ sub vcl_fetch {
# Unset Expires that is always overridden by Cache-Control. # Unset Expires that is always overridden by Cache-Control.
unset beresp.http.Expires; unset beresp.http.Expires;
# Unset Pragma header that is obsolete. # Unset Pragma that is obsolete.
unset beresp.http.Pragma; unset beresp.http.Pragma;
# We only cache 200 (OK) and 304 (Not Modified) responses. # We only cache 200 (OK) and 304 (Not Modified) responses.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment