mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +01:00
Add "Docker-Distribution-Api-Version" header for the 401 response of registry API
This is needed for "docker manifest" commands: https://github.com/docker/cli/issues/989 Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
6709dfb13f
commit
40890d2635
@ -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