Response header gaps: no Vary, X-Request-ID not returned or propagated, /v1/e/ lacks ETag/HEAD/304 #84
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Verified against
mainat61f42e6. Bundles three small, related response-header gaps fromTODO.mdplus one asymmetry found during the survey.1. No
Varyheader anywhere.grepforVaryreturns nothing. Harmless today, but it becomes a correctness bug the momentformat=autolands (filed separately): serving content negotiated onAcceptwithoutVary: Acceptmeans a shared cache will hand a WebP to a client that cannot display it. Add it as part of whichever change first makes a response depend on a request header — and addVary: Acceptdefensively now if that is soon.2.
X-Request-IDis generated and logged but never returned or propagated.chi'sRequestIDmiddleware is installed (internal/server/routes.go:19) and the ID reaches the logs (internal/middleware/middleware.go:90,96), but it is never written to the response, so a client cannot quote an ID when reporting a problem — which is the main reason to have one. It is also not forwarded upstream (internal/httpfetcher/httpfetcher.go:206-207sets only User-Agent and Accept), so a request cannot be traced across the proxy boundary. Additionally the per-image log lines (internal/handlers/image.go:161-168,internal/imgcache/service.go:270-280,338-351) do not carry the request ID, so they cannot be correlated with the access log line for the same request.3.
/v1/e/is missing response features/v1/image/has.internal/handlers/imageenc.go:69-85sets Content-Type, Content-Length, Cache-Control, and X-Pixa-Cache — but noETag, noIf-None-Match/304 handling, andinternal/server/routes.go:60registers onlyGet, noHead./v1/image/has all three (image.go:129-147,routes.go:55-56). Encrypted URLs are the ones most likely to be embedded in pages and re-requested, so they benefit from revalidation at least as much.Definition of done
X-Request-IDis set on every response./v1/e/setsETag, handlesIf-None-Matchwith a 304, and the route is registered forHEADas well asGET— reusing/v1/image/'s implementation rather than duplicating it.Varyis emitted wherever a response varies on a request header; if nothing varies yet, state that explicitly in the PR and leave it to theformat=autowork./v1/e/returns 304 on a matchingIf-None-Match;HEAD /v1/e/...returns headers with no body.make checkgreen.Note
Split into separate commits (one per item) — they are independent, and item 3 is the only one touching handler logic.