Commit 98899cde authored by Nils Goroll's avatar Nils Goroll

more polishing of the real world vcl code

- minimum ttl of 10s for HFM objects
- simplify the X-TTL code
- show is_esi() example
parent 892d825d
...@@ -124,6 +124,9 @@ varnish v1 \ ...@@ -124,6 +124,9 @@ varnish v1 \
unset beresp.http.X-TTL; unset beresp.http.X-TTL;
} else { } else {
set beresp.uncacheable = true; set beresp.uncacheable = true;
if (beresp.ttl < 10s) {
set beresp.ttl = 10s;
}
} }
return (deliver); return (deliver);
} }
...@@ -143,16 +146,14 @@ varnish v1 \ ...@@ -143,16 +146,14 @@ varnish v1 \
} }
sub br_deliver { sub br_deliver {
unset resp.http.X-TTL;
# for ESI:
# if (objesi.is_esi() || obj.uncacheable)
if (obj.uncacheable) { if (obj.uncacheable) {
# NOP # NOP
} else if (local.socket == "self_plain") { } else if (local.socket == "self_plain") {
if (obj.uncacheable) { set resp.http.X-TTL = obj.ttl;
unset resp.http.X-TTL;
} else {
set resp.http.X-TTL = obj.ttl;
}
} else { } else {
unset resp.http.X-TTL;
if (resp.http.Vary ~ "\bV-A-E\s*,") { if (resp.http.Vary ~ "\bV-A-E\s*,") {
set resp.http.Vary = regsub(resp.http.Vary, set resp.http.Vary = regsub(resp.http.Vary,
"\bV-A-E\s*,\s*", ""); "\bV-A-E\s*,\s*", "");
......
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