In Caddy 1.0.3 I’ve been seeing “superfluous response.WriteHeader
” and “wrote more than the declared Content-Length
” warnings / errors output in the logs.
Additionally at times I’ve seen erroneous additional text at the bottom of responses, mostly during error responses. e.g.
503 Service Unavailable
503 Service Unavailable
Instead of just:
503 Service Unavailable
This has been seen in successful responses (200) too (at the bottom of HTML responses) - but not captured at the time.
I managed to track it down to when the http.cache
plugin is used.
Whilst this could be two bugs - it’s likely related.
I’m noting it here for visibility of others before reporting this in the plugins repo.
Steps to reproduce
The version I tested with was downloaded from here: https://caddyserver.com/download/windows/amd64?plugins=http.cache&license=personal&telemetry=off
Caddyfile
http://localhost {
proxy / http://127.0.0.1
cache
log stdout
}
http:// {
status 418 /
log stdout
}
Console output
λ caddy -log stdout
Activating privacy features... done.
2019/09/27 18:57:35 [INFO][cache:0xc000196230] Started certificate maintenance routine
Serving HTTP on port 80
http://localhost
http://
2019/09/27 18:57:35 [INFO] Serving http://localhost
2019/09/27 18:57:35 [INFO] Serving http://
127.0.0.1 - - [27/Sep/2019:18:57:38 +0100] "GET / HTTP/1.1" 418 17
2019/09/27 18:57:38 http: superfluous response.WriteHeader call from github.com/caddyserver/caddy/caddyhttp/httpserver.(*ResponseRecorder).WriteHeader (recorder.go:61)
2019/09/27 18:57:38 [Error] failed to write body: http: wrote more than the declared Content-Length
::1 - - [27/Sep/2019:18:57:38 +0100] "GET / HTTP/1.1" 418 17
2019/09/27 18:58:23 [INFO] SIGINT: Shutting down
2019/09/27 18:58:23 [INFO][cache:0xc000196230] Stopped certificate maintenance routine
Removing the cache
line from the Caddyfile results in the errors / warnings not displaying.