22 lines
633 B
Plaintext
22 lines
633 B
Plaintext
// Cache only demonstrably public catalog pages. The origin must supply
|
|
// Cache-Control: public, max-age=120 and must not vary by user/session.
|
|
sub vcl_recv {
|
|
if (req.method != "GET" && req.method != "HEAD") {
|
|
return(pass);
|
|
}
|
|
if (req.http.Authorization || req.http.Cookie) {
|
|
return(pass);
|
|
}
|
|
if (req.url ~ "^/catalog(/|[?]|$)") {
|
|
return(hash);
|
|
}
|
|
return(pass);
|
|
}
|
|
|
|
sub vcl_backend_response {
|
|
if (bereq.url ~ "^/catalog(/|[?]|$)" && beresp.status == 200 && beresp.http.Cache-Control ~ "(^|,) *public(,|$)") {
|
|
set beresp.ttl = 120s;
|
|
set beresp.grace = 20s;
|
|
}
|
|
}
|