minio-browser: do not redirect to /minio if MINIO_BROWSER=off (#2863)

fixes #2837
This commit is contained in:
Krishna Srinivas 2016-10-06 21:00:32 +05:30 committed by Harshavardhana
parent 64f37bbf5b
commit bb9be02228

View File

@ -18,6 +18,7 @@ package cmd
import (
"net/http"
"os"
"path"
"regexp"
"strings"
@ -76,6 +77,7 @@ func setBrowserRedirectHandler(h http.Handler) http.Handler {
}
func (h redirectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if !strings.EqualFold(os.Getenv("MINIO_BROWSER"), "off") {
// Re-direction handled specifically for browsers.
if strings.Contains(r.Header.Get("User-Agent"), "Mozilla") && !isRequestSignatureV4(r) {
// '/' is redirected to 'locationPrefix/'
@ -89,6 +91,8 @@ func (h redirectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
}
}
h.handler.ServeHTTP(w, r)
}