Skip to content

CORS error on local setup despite setting Access-Control-Allow-Origin #426

@ducin

Description

@ducin

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

Bug description

After opening registry UI (http://localhost:5002/) I get the following error popping up:

error occurred: Check your connection and your registry must have Access-Control-Allow-Origin header set to http://localhost:5002

Image

everything LOCALLY. I'm failing on the most basic local setup.

How to Reproduce

This is my entire docker-compose file:

services:
  registry-server:
    image: registry:2.8.2
    container_name: registry-server
    ports:
      - "5001:5000"
    volumes:
      - registry-data:/var/lib/registry
    environment:
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '[http://registry-ui:5002,http://localhost:5002]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods: '[HEAD,GET,OPTIONS]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Credentials: '[true]'
      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers: '[Authorization,Accept,Cache-Control]'

  registry-ui:
    # docs: https://github.com/Joxit/docker-registry-ui/blob/main/README.md
    image: joxit/docker-registry-ui:latest
    container_name: registry-ui
    ports:
      - "5002:80"
    environment:
      - REGISTRY_TITLE=Deliveroo Registry
      - REGISTRY_URL=http://registry-server:5001
    depends_on:
      - registry-server

volumes:
  registry-data:

I've tried various combinations with this line:

  REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '[http://localhost:5002]'
  REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '["http://localhost:5002"]'
  REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '[http://registry-ui:5002,http://localhost:5002]'

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: Mac OS 15.4.1
  • Browser:
    • Name: Chrome v136
  • Docker registry UI:
    • Version: 2.8.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions