Page MenuHomePhabricator

Docker registry needs cache to vary on Accept header value
Closed, ResolvedPublic

Description

The responses from the docker registry can be different based on the presence or absence of an Accept header.

Specifically if the Accept header contains application/vnd.docker.distribution.manifest.v1+<format> or application/vnd.docker.distribution.manifest.v2+<format>, the responses are different.

Thus, we need to have the caching vary between different Accept headers at all levels.

Event Timeline

So long as the registry's responses do all the standards-based things correctly (they contain Vary: Accept, and the matching Accept values also match the Content-Type values in the responses), this should Just Work on a functional level.

There's an optimization issue here as well that requires some manual work (but may or may not be worth it in this case), which is for us to enforce the normalization of the Accept header on requests to this service to avoid redundant cache slots being created for meaningless trivial variations in different clients' Accept values which normalize identically in meaning to the application.

Change 650153 had a related patch set uploaded (by JMeybohm; owner: JMeybohm):
[operations/puppet@production] docker_registry_ha: Add "Vary: Accept" to response

https://gerrit.wikimedia.org/r/650153

Change 650153 merged by JMeybohm:
[operations/puppet@production] docker_registry_ha: Add "Vary: Accept" to response

https://gerrit.wikimedia.org/r/650153

The registry now responds properly with vary: Accept