lhns / docker-registry-cache

multi-registry docker image cache
https://github.com/users/lhns/packages/container/package/docker-registry-cache
Apache License 2.0
12 stars 3 forks source link

headers set but not forwarded by docker-registry-cache #196

Open fundef1 opened 6 months ago

fundef1 commented 6 months ago

Hi, i think docker-registry-cache strips the headers from /bin/registry The "X-Content-Type-Options: nosniff" header is defined in config.yaml but is not served in the response.

as a test I started another registry within the container (on port 9090) but otherwise same config.yaml. so it seems environment variables are picked up correctly.

 wget -S http://127.0.0.1:9090/v2/_catalog -O -
Connecting to 127.0.0.1:9090 (127.0.0.1:9090)
  HTTP/1.1 200 OK
  Access-Control-Allow-Credentials: true
  Access-Control-Allow-Headers: Authorization
  Access-Control-Allow-Headers: Accept
  Access-Control-Allow-Headers: Cache-Control
  Access-Control-Allow-Methods: HEAD
  Access-Control-Allow-Methods: GET
  Access-Control-Allow-Methods: OPTIONS
  Access-Control-Allow-Methods: DELETE
  Access-Control-Allow-Origin: *
  Access-Control-Expose-Headers: Docker-Content-Digest
  Content-Type: application/json; charset=utf-8
  Docker-Distribution-Api-Version: registry/2.0
  X-Content-Type-Options: nosniff
  Date: Sat, 11 May 2024 09:44:36 GMT
  Content-Length: 20
  Connection: close

yet the response from docker-registry-cache strips these headers

wget -S http://127.0.0.1:5000/v2/_catalog -O -
Connecting to 127.0.0.1:5000 (127.0.0.1:5000)
  HTTP/1.1 200 OK
  Date: Sat, 11 May 2024 10:03:46 GMT
  Connection: close
  Content-Type: application/json
  Content-Length: 134

I've tried both 0.3.0 and ghcr.io/lhns/docker-registry-cache:8a0f0820 (which looks to be the latest build).

thanks

lhns commented 5 months ago

Hi, this is weird behavour indeed. I could not yet confirm this issue myself. I have only looked at the code for now but all headers should be forwarded to the configured registry.