mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -05:00
Redirect /minio to /minio/ when requests come from browsers (#2937)
This commit is contained in:
parent
903574db90
commit
5c3639c1b7
@ -80,15 +80,20 @@ func (h redirectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
if !strings.EqualFold(os.Getenv("MINIO_BROWSER"), "off") {
|
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) {
|
||||||
|
switch r.URL.Path {
|
||||||
|
case "/", "/webrpc", "/login", "/favicon.ico":
|
||||||
// '/' is redirected to 'locationPrefix/'
|
// '/' is redirected to 'locationPrefix/'
|
||||||
// '/webrpc' is redirected to 'locationPrefix/webrpc'
|
// '/webrpc' is redirected to 'locationPrefix/webrpc'
|
||||||
// '/login' is redirected to 'locationPrefix/login'
|
// '/login' is redirected to 'locationPrefix/login'
|
||||||
switch r.URL.Path {
|
|
||||||
case "/", "/webrpc", "/login", "/favicon.ico":
|
|
||||||
location := h.locationPrefix + r.URL.Path
|
location := h.locationPrefix + r.URL.Path
|
||||||
// Redirect to new location.
|
// Redirect to new location.
|
||||||
http.Redirect(w, r, location, http.StatusTemporaryRedirect)
|
http.Redirect(w, r, location, http.StatusTemporaryRedirect)
|
||||||
return
|
return
|
||||||
|
case h.locationPrefix:
|
||||||
|
// locationPrefix is redirected to 'locationPrefix/'
|
||||||
|
location := h.locationPrefix + "/"
|
||||||
|
http.Redirect(w, r, location, http.StatusTemporaryRedirect)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user