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