TTL <=0 ?

Geoff Simmons geoff at uplex.de
Tue Sep 27 13:31:52 UTC 2022


On 9/27/22 15:07, Johan Hendriks wrote:
> Hello all, varnish tells me that the TTL is smaller or equal to 0, but 
> looking at the response headers that is not the case as the BerespHeader 
> has  Expires: Wed, 27 Sep 2023 12:23:11 GMT which is in 2023!
> 
> -   Begin          bereq 8203147 pass

The request was set to pass on the client side; that sets 
bereq.uncacheable=true, which is passed along to the backend side as 
beresp.uncacheable=true.

The Expires response header (and also Cache-Control in your example) 
might at least tell browser caches that they can cache the response. But 
Varnish won't cache it.

[...]
> -   BereqHeader    Cookie: _sharedid=redacted; cto_bundle=redacted
[...]

> Am i right that the TTL is <=0 because it sends a cookie to the backend?

If you haven't changed this part of builtin.vcl, then yes:

sub vcl_req_cookie {
	if (req.http.Cookie) {
		# Risky to cache by default.
		return (pass);
	}
}

If a request/response has a property such as a Cookie header, and a 
number of other things that suggest that the response may be 
personalized, then it can't take the chance of caching it by default. 
That can be one of the worst mistakes you can make with a caching proxy.

So if you need to be able to cache despite the presence of cookies, as 
do many sites these days, you need to write rules for that in VCL. 
Default VCL has to make the safest choice.


Best,
Geoff
-- 
** * * UPLEX - Nils Goroll Systemoptimierung

Scheffelstraße 32
22301 Hamburg

Tel +49 40 2880 5731
Mob +49 176 636 90917
Fax +49 40 42949753

http://uplex.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20220927/1098f1c9/attachment.bin>


More information about the varnish-misc mailing list