IT Knowledge/Repository

Harbor 구성시 오류 - Image Upload 401 unauthorized

Seok. 2025. 4. 25. 15:51
반응형

Harbor Project(Type Project) 설정된 저장소에 Docker Image 업로드 되지 않는 현상

 

업로드 실패 이유는? 401 unauthorized

 

[나의 Harbor 구성]

nginx1(https, letsencrypt) <-> harbor proxy(nginx, http) <-> harbor ui/registry 

ReverseProxy Nginx(HTTPS) 뒤에 HTTP Harbor 실행

( Running Harbor with HTTP behind a HTTPS Reverse Proxy (nginx) )

 

 

조치방안

Harbor 앞단에 ReverseProxy 역할을 하는 nginx에서 서비스에 필요한 설정을 넘겨주지 않았다.

이를 위해 아래와 같이 설정하면 가능하다

## Second Server Configuration

    server {
        listen 443 ssl;
        server_name  <servername>;

        chunked_transfer_encoding on;
        client_max_body_size 0;

        location / {
        proxy_pass                 http://harbor:80;
        proxy_set_header    Host                                   $http_host;
        proxy_set_header    X-Real-IP                           $remote_addr;
        proxy_set_header    X-Forwarded-For             $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto         $scheme;

        proxy_buffering     off;
        proxy_request_buffering     off;
        }
    }

 

 

 

참고자료 : https://github.com/goharbor/harbor/issues/3114

반응형