Http: multiple response.WriteHeader calls

I’m seeing a bunch of http: multiple response.WriteHeader calls output in the logs.

Is this something to worry about and be tracked down?


I’m using “cache” and “proxy” - I don’t know if that indicates direction.

http://example.uk,
example.net,
www.example.net,
example.com,
www.example.com {
	cache {
		status_header X-Cache-Status
	}
	proxy / 95.142.xxx.xxx {
		transparent
	}
	tls support@example.com
}

http:// {
	root /var/www
	gzip
}

I can’t seem to reproduce the precise occurrence of http: multiple response.WriteHeader calls by making requests to the domains.

Requests to the 95.142.xxx.xxx all Connection: close (so no keep alive).

Seeing this in 0.11.0 and previous 0.10.x

My money’s on cache as the culprit; I’m not aware of any clashing WriteHeader response calls in the proxy code. Are you able to test for a while without cache and see if the error persists?

Edit: Might have something to do with the way cache copies the request and sends the copy down the middleware chain in order to retrieve the response to be cached?

As to whether it’s something that needs worrying about, that’s a solid maybe. For instances of multiple WriteHeader calls, the later calls are ignored, so if they’re adding important information it might be lost.

2 Likes

Thanks for your insight @Whitestrake

I tried removing the cache config sections consisting of the following:

	cache {
		status_header X-Cache-Status
	}

And ran for over 24 hours without an occurrence of the log:

http: multiple response.WriteHeader calls

Put the config sections back in and saw an occurrence of the offending log entry after just 5 minutes and then several after that within 2-3 minutes.

Reported the bug in the cache project issues:
https://github.com/nicolasazrak/caddy-cache/issues/35

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.