Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Commit 1651225

Browse files
committed
Limit the traces to the / path
1 parent 6d8623a commit 1651225

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

main.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,12 @@ func main() {
519519
}
520520
defer queue.Close()
521521

522-
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
522+
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
523+
if r.URL.Path != "/" {
524+
http.NotFound(w, r)
525+
return
526+
}
527+
523528
id, err := StreamIDFromHostPort(r.RemoteAddr)
524529
if err != nil {
525530
log.Panic(err)
@@ -608,7 +613,7 @@ func main() {
608613
fmt.Printf("Serving on %v...\n", s.HostPort())
609614
server := http.Server{
610615
Addr: s.HostPort(),
611-
Handler: handlers.CombinedLoggingHandler(os.Stdout, cors.Default().Handler(handler)),
616+
Handler: handlers.CombinedLoggingHandler(os.Stdout, cors.Default().Handler(http.DefaultServeMux)),
612617
TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){},
613618
}
614619
server.SetKeepAlivesEnabled(false)

0 commit comments

Comments
 (0)