#416

DEFAULT_REGISTRIES CORS issue

Opendecsunopened 1y ago

Hi, I use this docker registry UI and I have an issue...

Bug description

When I set multiple DEFAULT_REGISTRIES, I always get CORS errors. Even though I have set the repository: Access-Control-Allow-Origin: * I'm using vscode to forward port from the server to my localhost mac.

How to Reproduce

Just use the following yaml to create the registry and UI. I'm sure registries work well. The problem is in the UI.

For service bug, steps to reproduce the behavior:

My docker-compose file

version: '3.8'

services:
  registry-public:
    image: registry:latest
    restart: always
    environment:
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: "['*']"
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods: '[HEAD,GET,OPTIONS,DELETE]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Credentials: '[true]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers: '[Authorization,Accept,Cache-Control]'
      REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers: '[Docker-Content-Digest]'
      REGISTRY_STORAGE_DELETE_ENABLED: 'true'
    volumes:
      - /registry/public:/var/lib/registry
      - /registry/registry_conf_pub.yml:/etc/docker/registry/config.yml
    ports:
      - 5000:5000
    container_name: registry-public

  registry-private:
    image: registry:latest
    restart: always
    environment:
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: "['*']"
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods: '[HEAD,GET,OPTIONS,DELETE]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Credentials: '[true]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers: '[Authorization,Accept,Cache-Control]'
      REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers: '[Docker-Content-Digest]'
      REGISTRY_STORAGE_DELETE_ENABLED: 'true'
    volumes:
      - /registry/private:/var/lib/registry
      - /registry/registry_conf_pri.yml:/etc/docker/registry/config.yml
    ports:
      - 5001:5000
    container_name: registry-private

  registry-ui:
    image: joxit/docker-registry-ui:main
    volumes:
      - ./registry-data:/var/lib/registry
    restart: always
    ports:
      - 18082:80
    environment:
      - REGISTRY_TITLE=Multi Registry
      - DEFAULT_REGISTRIES=http://10.100.100.1:5000,http://10.100.100.1:5001
      - SINGLE_REGISTRY=false
      - DELETE_IMAGES=true
      - SHOW_CONTENT_DIGEST=true
      - SHOW_CATALOG_NB_TAGS=true
      - CATALOG_MIN_BRANCHES=1
      - TAGLIST_PAGE_SIZE=100
      - REGISTRY_SECURED=false
      - CATALOG_ELEMENTS_LIMIT=1000
      # - READ_ONLY_REGISTRIES=true
    container_name: registry-ui

curl -I http://10.100.100.1:5000/v2/ 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-Length: 2 Content-Type: application/json; charset=utf-8 Docker-Distribution-Api-Version: registry/2.0 Date: Mon, 31 Mar 2025 15:56:24 GMT

Screenshots

System information

  • OS: Server: Ubuntu, Host: Mac OS
  • Browser:
    • Name: Chrome, Safari
  • Docker registry UI:
    • Version: latest

Activity

1
Joxit1y ago

Hi there, you may read the CORS Section in the Readme