I’ve just spent much more time than I ever wanted to get this right, so here’s how I did it for future reference. I have a function that returns an http.Handler, kind of like this: func Handler(prefix string) http.Handler { r := mux.NewRouter().PathPrefix(prefix).Subrouter() r.HandleFunc(“/foo/”, fooHandler).Methods(“GET”) r.HandleFunc(“/bar/”, barHandler).Methods(“GET”) return r } The prefix could be something…