mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 04:05:40 +01:00
Merge pull request #10868 from ywk253100/200227_auth
Add "Docker-Distribution-Api-Version" header for the 401 response of registry API
This commit is contained in:
commit
45aac8c597
@ -130,6 +130,8 @@ func Middleware() func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||
if err := checker.check(req); err != nil {
|
||||
// the header is needed for "docker manifest" commands: https://github.com/docker/cli/issues/989
|
||||
rw.Header().Set("Docker-Distribution-Api-Version", "registry/2.0")
|
||||
serror.SendError(rw, ierror.UnauthorizedError(err).WithMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user