Joxit / docker-registry-ui

The simplest and most complete UI for your private registry
https://joxit.dev/docker-registry-ui/
GNU Affero General Public License v3.0
2.57k stars 322 forks source link

Always get CORS error when enabling credentials #340

Closed FaisalBudiono closed 1 year ago

FaisalBudiono commented 1 year ago

Bug description

I always get CORS error when enabling credentials. My work around is to disable the credential whenever I want to do a cleanup, but it will mess with the pipeline (Since I need to restart my registry).

I tested my registry config with docker login and it works fine.

How to Reproduce

For UI bug, steps to reproduce the behavior:

  1. Click Image
  2. See tag list
  3. Tag list is missing information and we can see CORS error

My private docker registry configuration

version: 0.1
log:
  fields:
    service: registry
storage:
  cache:
    blobdescriptor: inmemory
  filesystem:
    rootdirectory: /data
  delete:
    enabled: true
  maintenance:
    uploadpurging:
      enabled: true
      age: 168h
      interval: 24h
      dryrun: false
    readonly:
      enabled: false
http:
  addr: :5000
  headers:
    X-Content-Type-Options: [nosniff]
    Access-Control-Allow-Origin: ['https://ui-url.example.com']
    Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE']
    Access-Control-Allow-Headers: ['Authorization', 'Accept', 'Cache-Control']
    Access-Control-Max-Age: [1728000]
    Access-Control-Expose-Headers: ['Docker-Content-Digest']
    Access-Control-Allow-Credentials: [true]
health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3
auth:
  htpasswd:
    realm: basic-realm
    path: /auth/.password
REGISTRY_TITLE=Docker Registry 
REGISTRY_URL=https://reg.example.com
SINGLE_REGISTRY=true
SHOW_CONTENT_DIGEST=true
DELETE_IMAGES=true
REGISTRY_SECURED=true
NGINX_PROXY_PASS_URL=http://srv-captain--docker-registry:5000

I did try this with and without NGINX_PROXY_PASS_URL

Expected behavior

Should be able to see the detail and delete the image.

Screenshots

image

System information

Joxit commented 1 year ago

Hi, thank you for using my project and submitting issues :smile:

When you used NGINX_PROXY_PASS_URL did you removed REGISTRY_URL ? It will interfere with the configuration.

Do you have more intel on where the CORS is send ? Which server ? The UI or the registry or both ?

FaisalBudiono commented 1 year ago

@Joxit Removing REGISTRY_URL really solved this issue, thanks! I'm sure I tried this yesterday but it didn't work for some reason. Again, thanks a lot for making this wonderful project!

Joxit commented 1 year ago

It was a pleasure and thank you 😊