-
-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new option ADD_NO_CACHE_HEADER
on requests to registry server
#265
Conversation
Hi, I tried the new image and I still have the problem. A curl example:
I can see an HXR request on |
Your browser sent the request on Can you sent me the result of |
Yes the browser sent the request with the
Response headers (304):
Response body: {
"manifests": [
{
"digest": "sha256:f26fbadb0acab4a21ecb4e337a326907e61fbec36c9a9b52e725669d99ed1261",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "amd64",
"os": "linux"
},
"size": 1570
},
{
"digest": "sha256:df0d884bcf2e51ad370f16bcbe6d4cef68fd8057b63da89b77c228a680e7ed8a",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "arm",
"os": "linux",
"variant": "v5"
},
"size": 1570
},
{
"digest": "sha256:ef2ad3781f412ae3052ef56f5938be93fef49d4204ecb36af2cec4d443ad9895",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "arm",
"os": "linux",
"variant": "v7"
},
"size": 1570
},
{
"digest": "sha256:f5bee9654d19467f16c259fb577c4a28c082f8008914befd30805f803fa56e99",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "arm64",
"os": "linux",
"variant": "v8"
},
"size": 1570
},
{
"digest": "sha256:d830cc525721daa5769bf9876db421987aefeff16c5074edc0c6b9061f8ff359",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "386",
"os": "linux"
},
"size": 1570
},
{
"digest": "sha256:3e7402f0eb053ffd769097c9c726b39b0318e3f5a2538e7b63779714e646de93",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "mips64le",
"os": "linux"
},
"size": 1570
},
{
"digest": "sha256:f1d915d7215a80b1a294ec8e9005a4b7984e650e06cb9b52f57e830576245c74",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "ppc64le",
"os": "linux"
},
"size": 1570
},
{
"digest": "sha256:ead4adf366b0333e5f7e10f32b2b7814b3ea39807db3c3ac029d4404140da5b0",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "s390x",
"os": "linux"
},
"size": 1570
}
],
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"schemaVersion": 2
} A screenshot of my browser console on |
Okay, thank you for your response 😄 What's your configuration for the docker registry ui (the docker-compose) ? Did you add the environment variable |
Yes, here my config: registry-ui:
container_name: registry-ui
restart: always
image: joxit/docker-registry-ui:feat-no-cache
environment:
REGISTRY_TITLE: XXX private Docker registry
REGISTRY_URL: https://myregistry.example
NGINX_PROXY_PASS_URL: https://myregistry.example
ADD_NO_CACHE_HEADER: "true"
DELETE_IMAGES: "true"
SINGLE_REGISTRY: "true"
SHOW_CONTENT_DIGEST: "true" [EDIT] And the registry container was re-recreated, cf. "Config": {
"Hostname": "c11156482aa8",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"REGISTRY_TITLE=XXX private Docker registry",
"REGISTRY_URL=https://myregistry.example",
"NGINX_PROXY_PASS_URL=https://myregistry.example",
"ADD_NO_CACHE_HEADER=true",
"DELETE_IMAGES=true",
"SINGLE_REGISTRY=true",
"SHOW_CONTENT_DIGEST=true",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.23.1",
"NJS_VERSION=0.7.6",
"PKG_RELEASE=1",
"NGINX_PROXY_HEADER_Host=$http_host",
"NGINX_LISTEN_PORT=80",
"SHOW_CATALOG_NB_TAGS=false"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"Image": "joxit/docker-registry-ui:feat-no-cache",
"Volumes": null,
"WorkingDir": "/usr/share/nginx/html",
"Entrypoint": [
"/docker-entrypoint.sh"
], |
I try your configuration and it works..... on Chrome but not Firefox 😭 |
I am glad you can reproduce the issue. BTW Thanks for this project ! |
58d938d
to
f9ede70
Compare
It's a pleasure 😄 I needed this for my work too 😄 I pushed a new version (Image id |
It works 🙌 👍 Well done ! |
Yeah! Thanks! 😁 I will publish this tonight with the documentations |
…e-Control` header on requests to registry server This requires a change in your registry server configuration
f9ede70
to
41d5e6d
Compare
I've renamed the option, it will be |
Hi @loliee, thank you again for your help. I added you in my contributors list 😄 |
I will need to grab a copy of 2.3.0 and then apply the same changes here. Thanks a bunch for the help. I was always able to just 'forget' about the problem since I don't use my registry all that much. Eventually, the problem would fix itself (for me). But now it sounds like I don't have to worry about it. |
I finally got around to working on this on my home network and I can confirm that this solution works. I no longer have this issue while using firefox (or any browser). |
Background
I'm facing some issues with registry server cache control (see #260 (comment))
The docker registry UI is built on top of the registry server API v2 and it implements some HTTP specs incorrectly. This time I'm talking about cache control and ETag.
As I speak, when you are requesting a resource such as a tag manifest (e.g.
/v2/nginx/manifests/1.23
) and your browser cache control is activated, you will get a ETag in the response. When you use this ETag inIf-None-Match
header, you will receive 304 even if your headers and the body have changed.How to fix it ?
This issue will be appear on multi-arch images only. With this PR you can add an option
ADD_NO_CACHE_HEADER=true
on your registry UI and you must addCache-Control
in your registry serverAccess-Control-Allow-Headers
configuration.Try this PR with this image