I'm running on HTTPS (port 10443) and use subroutes:
mainRoute := mux.NewRouter() mainRoute.StrictSlash(true) mainRoute.Handle("/", http.RedirectHandler("/static/", 302)) mainRoute.PathPrefix("/static/").Handler(http.StripPrefix("/static", *fh)) // Bind API Routes apiRoute := mainRoute.PathPrefix("/api").Subrouter() apiProductRoute := apiRoute.PathPrefix("/products").Subrouter() apiProductRoute.Handle("/", handler(listProducts)).Methods("GET") And the functions:
func listProducts(w http.ResponseWriter, r *http.Request) (interface{}, *handleHTTPError) { vars := mux.Vars(r) productType, ok := vars["id"] log.Println(productType) log.Println(ok) } ok is false and I have no idea why. I'm doing a simple ?type=model after my URL..