Revert "redirect to console project for browser (#12172)"

This reverts commit 301669cf7b.

fixes #12179
This commit is contained in:
Harshavardhana 2021-04-28 12:22:04 -07:00
parent 0c9d095deb
commit 77f9c71133

View File

@ -131,26 +131,8 @@ const (
loginPathPrefix = SlashSeparator + "login"
)
// guessIsBrowserReq - returns true if the request is browser.
// This implementation just validates user-agent and
// looks for "Mozilla" string. This is no way certifiable
// way to know if the request really came from a browser
// since User-Agent's can be arbitrary. But this is just
// a best effort function.
func guessIsBrowserReq(req *http.Request) bool {
if req == nil {
return false
}
aType := getRequestAuthType(req)
return strings.Contains(req.Header.Get("User-Agent"), "Mozilla") && (aType == authTypeJWT || aType == authTypeAnonymous)
}
func setRedirectHandler(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if guessIsBrowserReq(r) {
http.Redirect(w, r, "https://github.com/minio/console", http.StatusMovedPermanently)
return
}
if !shouldProxy() || guessIsRPCReq(r) || guessIsHealthCheckReq(r) ||
guessIsMetricsReq(r) || isAdminReq(r) {
h.ServeHTTP(w, r)