|
@@ -179,11 +179,18 @@ func defaultWebServer(args *plugin.HTTPServerArgs) error {
|
179
|
179
|
// https://github.com/google/pprof/pull/348
|
180
|
180
|
mux := http.NewServeMux()
|
181
|
181
|
mux.Handle("/ui/", http.StripPrefix("/ui", handler))
|
182
|
|
- mux.Handle("/", http.RedirectHandler("/ui/", http.StatusTemporaryRedirect))
|
|
182
|
+ mux.Handle("/", redirectWithQuery("/ui"))
|
183
|
183
|
s := &http.Server{Handler: mux}
|
184
|
184
|
return s.Serve(ln)
|
185
|
185
|
}
|
186
|
186
|
|
|
187
|
+func redirectWithQuery(path string) http.HandlerFunc {
|
|
188
|
+ return func(w http.ResponseWriter, r *http.Request) {
|
|
189
|
+ pathWithQuery := &gourl.URL{Path: path, RawQuery: r.URL.RawQuery}
|
|
190
|
+ http.Redirect(w, r, pathWithQuery.String(), http.StatusTemporaryRedirect)
|
|
191
|
+ }
|
|
192
|
+}
|
|
193
|
+
|
187
|
194
|
func isLocalhost(host string) bool {
|
188
|
195
|
for _, v := range []string{"localhost", "127.0.0.1", "[::1]", "::1"} {
|
189
|
196
|
if host == v {
|