Skip to content

The Container registry ignores ports. #31907

@phi-friday

Description

@phi-friday

Description

스크린샷 2024-08-23 오후 3 05 09

We assigned the web server to 443 and the gitea server to 12080.
All other functions in gitea use the 12080 port normally.
(pypi on the same port works fine.
스크린샷 2024-08-23 오후 3 49 25
)

However, we noticed that when we specify Container registry with docker login,
it takes us to the webpage we assigned to 443.
When I checked the given path directly in my browser,
I saw that the port is being ignored in the www-authenticate: header.

Is there any way to set the port in this case?

Gitea Version

1.22.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker:

services:
  repository:
    container_name: git-server
    image: gitea/gitea:1.22.1
    restart: always
    env_file:
      - .env
    ports:
      - "127.0.0.1:${GITEA_SSH_PORT}:22"
    networks:
      - public-network
    command:
      - sh
      - -c
      - |
        sh /init.sh
        /bin/s6-svscan /etc/s6
    volumes:
      - git-server:/data
      - type: bind
        source: "/home/${GITEA_SSH_USER_NAME}/.ssh"
        target: "/data/git/.ssh"
        read_only: false
      - type: bind
        source: "./app.ini.default"
        target: "${GITEA_APP_DEFAULT_PATH}"
        read_only: true
      - type: bind
        source: "./init.sh"
        target: "/init.sh"
        read_only: true
    extra_hosts:
      - ${COMMON_PROXY_LOCAL_HOST}:host-gateway
      - ${COMMON_ADDITIONAL_PROXY_LOCAL_HOST}:host-gateway
    logging:
      options:
        max-size: 10m
        max-file: 1

volumes:
  git-server:
    external: true

networks:
  public-network:
    external: true

nginx:

include /etc/nginx/forwarded.conf;

server {
    listen ${GITEA_PORT} ssl;
    listen [::]:${GITEA_PORT} ssl;
    server_name ${COMMON_HOST_NAME};
    http2 on;

    ssl_certificate /etc/nginx/${COMMON_CERT_KEY_NAME}.crt;
    ssl_certificate_key /etc/nginx/${COMMON_CERT_KEY_NAME}.rsa;
    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout  10m;
    #ssl_ciphers PROFILE=SYSTEM;
    ssl_prefer_server_ciphers on;

    error_page 497 =307 https://$host:$server_port$request_uri;
    set $gitea_target "${GITEA_HOST}:${GITEA_REPOSITORY_PORT}";

    # gitea
    location / {
        client_max_body_size 2G;

        resolver 127.0.0.11 valid=30s;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header Host $host:${GITEA_PORT};

        proxy_pass http://$gitea_target;
        proxy_redirect off;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $http_connection;

        proxy_set_header Forwarded "$proxy_add_forwarded;proto=$scheme";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port ${GITEA_PORT};
    }
}

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/needs-feedbackFor bugs, we need more details. For features, the feature must be described in more detail

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions