mirror of https://github.com/minio/minio.git
parent
aa78505181
commit
9dae5a7c85
|
@ -154,15 +154,15 @@ func setRedirectHandler(h http.Handler) http.Handler {
|
||||||
|
|
||||||
func guessIsBrowserReq(r *http.Request) bool {
|
func guessIsBrowserReq(r *http.Request) bool {
|
||||||
aType := getRequestAuthType(r)
|
aType := getRequestAuthType(r)
|
||||||
ok := strings.Contains(r.Header.Get("User-Agent"), "Mozilla") && globalBrowserEnabled &&
|
return strings.Contains(r.Header.Get("User-Agent"), "Mozilla") &&
|
||||||
(aType == authTypeJWT || aType == authTypeAnonymous)
|
globalBrowserEnabled && aType == authTypeAnonymous
|
||||||
return ok
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setBrowserRedirectHandler(h http.Handler) http.Handler {
|
func setBrowserRedirectHandler(h http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
read := r.Method == http.MethodGet || r.Method == http.MethodHead
|
||||||
// Re-direction is handled specifically for browser requests.
|
// Re-direction is handled specifically for browser requests.
|
||||||
if guessIsBrowserReq(r) {
|
if guessIsBrowserReq(r) && read {
|
||||||
// Fetch the redirect location if any.
|
// Fetch the redirect location if any.
|
||||||
if u := getRedirectLocation(r); u != nil {
|
if u := getRedirectLocation(r); u != nil {
|
||||||
// Employ a temporary re-direct.
|
// Employ a temporary re-direct.
|
||||||
|
|
Loading…
Reference in New Issue