1
0
mirror of https://github.com/minio/minio.git synced 2025-04-09 14:10:10 -04:00

Redirect browser requests only if browser is enabled ()

This PR fixes an issue introduced in PR , when
browser is disabled we shouldn't re-direct the requests
returning AccessDenied.

Fixes 
This commit is contained in:
Harshavardhana 2018-12-03 23:38:24 -08:00 committed by Nitish Tiwari
parent 18ced1102c
commit 20e61fb362

@ -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