forked from TrueCloudLab/distribution
Only do auth checks for endpoints starting with v2
Changes behavior so ping doesn't happen if /v2/ is anywhere in a request path, but instead only at the beginning. This fixes attempts to ping on redirected URLs. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
parent
c7f7747368
commit
49369ffe9a
1 changed files with 3 additions and 1 deletions
|
@ -94,7 +94,9 @@ HeaderLoop:
|
||||||
|
|
||||||
func (ta *tokenAuthorizer) ModifyRequest(req *http.Request) error {
|
func (ta *tokenAuthorizer) ModifyRequest(req *http.Request) error {
|
||||||
v2Root := strings.Index(req.URL.Path, "/v2/")
|
v2Root := strings.Index(req.URL.Path, "/v2/")
|
||||||
if v2Root == -1 {
|
// Test if /v2/ does not exist or not at beginning
|
||||||
|
// TODO(dmcgowan) support v2 endpoints which have a prefix before /v2/
|
||||||
|
if v2Root == -1 || v2Root > 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue