Skip to content

Commit

Permalink
fix: redirect /debug/pprof to avoid jumping to a blank page in httpd …
Browse files Browse the repository at this point in the history
…and meta service (#45)

* bugfix:Add a redirect form /debug/pprof to /debug/pprof

* chore: modify the comment of redirecting to /debug/pprof

* fix(meta): redirect /debug/pprof to avoid jumping to a blank page in meta service

* chore: update status code 302 to 307 in /debug/pprof

---------

Co-authored-by: xiejunqiao <[email protected]>
Co-authored-by: Shiwen Cheng <[email protected]>
  • Loading branch information
3 people authored Sep 29, 2024
1 parent 194fcaa commit 411d156
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions services/httpd/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ func (h *Handler) handleProfiles(w http.ResponseWriter, r *http.Request) {
httppprof.Symbol(w, r)
case "/debug/pprof/all":
h.archiveProfilesAndQueries(w, r)
case "/debug/pprof":
// Redirect to /debug/pprof/ to avoid jumping to a blank page
// after clicking the links on the /debug/pprof webpage.
http.Redirect(w, r, "/debug/pprof/", http.StatusTemporaryRedirect)
default:
httppprof.Index(w, r)
}
Expand Down
4 changes: 4 additions & 0 deletions services/meta/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func (h *handler) handleProfiles(w http.ResponseWriter, r *http.Request) {
httppprof.Symbol(w, r)
case "/debug/pprof/all":
h.archiveProfiles(w, r)
case "/debug/pprof":
// Redirect to /debug/pprof/ to avoid jumping to a blank page
// after clicking the links on the /debug/pprof webpage.
http.Redirect(w, r, "/debug/pprof/", http.StatusTemporaryRedirect)
default:
httppprof.Index(w, r)
}
Expand Down

0 comments on commit 411d156

Please sign in to comment.