I use Caddy as a reverse proxy with a backend that sometimes needs to return 204 No Content response codes. Our backend generates the 204 response along with a Content-Length: 0:
HTTP/1.1 204 No Content
Date: Tue, 30 Aug 2016 06:28:44 GMT
Cache-Control: no-cache
Content-Length: 0
but Caddy strips the Content-Length header:
HTTP/1.1 204 No Content
Cache-Control: no-cache
Date: Tue, 30 Aug 2016 06:28:44 GMT
Is there a way to make caddy keep the Content-Length header, or re-add it for 204 responses? (I use the latest version 0.9.1)
@ciconia I think the code is not behaving as you say, this line starts with if clen == "" which if set to "0", then it won’t be overwritten in that conditional block.
this line starts a conditional block that could empty the variable if non-empty on entry but the condition is clen64 >= 0 and it clearly would be zero in this case.
I haven’t had time to dig into the Caddy source to see where this behaviour might stem from though…