From 20e61fb36226414e1e7f91dda209f959fce9c026 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 3 Dec 2018 23:38:24 -0800 Subject: [PATCH] Redirect browser requests only if browser is enabled (#6909) This PR fixes an issue introduced in PR #6848, when browser is disabled we shouldn't re-direct the requests returning AccessDenied. Fixes #6907 --- cmd/api-response.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/api-response.go b/cmd/api-response.go index 68ec85b98..2977ffc37 100644 --- a/cmd/api-response.go +++ b/cmd/api-response.go @@ -575,7 +575,9 @@ func writeErrorResponse(w http.ResponseWriter, errorCode APIErrorCode, reqURL *u // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After w.Header().Set("Retry-After", "120") case ErrAccessDenied: - if browser { + // The request is from browser and also if browser + // is enabled we need to redirect. + if browser && globalIsBrowserEnabled { w.Header().Set("Location", minioReservedBucketPath+reqURL.Path) w.WriteHeader(http.StatusTemporaryRedirect) return