varnish-cache icon indicating copy to clipboard operation
varnish-cache copied to clipboard

cache_fetch: Send Content-Length: 0 for anything not GET or HEAD

Open nigoroll opened this issue 6 months ago • 3 comments

otherwise keep the existing logic of sending no Content-Length header if there is no request body.

Supersedes #4332

This approach was determined to be better than the inverse of sending C-L: 0 for specific methods to avoid backends sending 411 responses as noted in https://github.com/varnishcache/varnish-cache/issues/4331#issuecomment-2911514551

This code runs before vcl_backend_fetch, so should VCL gain back control over Content-Length as proposed in #4331, it will be possible again to override this default.

Fixes #4331 for the special case

nigoroll avatar Jun 02 '25 11:06 nigoroll

bugwash: +1 from phk, walid passes on to @dridi

nigoroll avatar Jun 02 '25 13:06 nigoroll

@nigoroll @dridi will this change be part of the next regular varnish release? we are clearly looking forward to solve the issue with content-length as we have been struck by the new behavior but wanted to upgrade to 7.7.1

thomasklinger1234 avatar Jul 31 '25 13:07 thomasklinger1234

@thomasklinger1234 the only way to know for sure if a PR is going to be in the next release is a merge. Whenever we or someone thought to make different predictions in the past, chances were very high that they turned out wrong.

That said, if you have a concrete requirement to solve, you might want to look at https://github.com/varnishcache/varnish-cache/pull/4340/files#diff-9d1d0b70f01c3c5306ebd1b610e210697ed18e0dcb6b4af9f9245b01a7972c2d

nigoroll avatar Jul 31 '25 14:07 nigoroll