From 04c87264b17db5ad4bb51ba33b92709211dbd069 Mon Sep 17 00:00:00 2001 From: Masashi Salvador Mitsuzawa Date: Mon, 15 Apr 2019 11:59:39 +0900 Subject: [PATCH] fix the wrong path configuration in root redirection before: when path = "" => // -> handler after: when path = "" => / -> handler License: MIT Signed-off-by: Masashi Salvador Mitsuzawa --- core/corehttp/redirect.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/corehttp/redirect.go b/core/corehttp/redirect.go index ec70ffaf9..e7b961e60 100644 --- a/core/corehttp/redirect.go +++ b/core/corehttp/redirect.go @@ -10,7 +10,11 @@ import ( func RedirectOption(path string, redirect string) ServeOption { handler := &redirectHandler{redirect} return func(n *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) { - mux.Handle("/"+path+"/", handler) + if len(path) > 0 { + mux.Handle("/"+path+"/", handler) + } else { + mux.Handle("/", handler) + } return mux, nil } }