r.Route before r.Use
This commit is contained in:
parent
7dff34e6e3
commit
6810c6f86d
|
@ -29,11 +29,14 @@ var presenters = make(chan *Challenge)
|
||||||
var cleanups = make(chan *Challenge)
|
var cleanups = make(chan *Challenge)
|
||||||
|
|
||||||
func RouteStatic(r chi.Router) chi.Router {
|
func RouteStatic(r chi.Router) chi.Router {
|
||||||
|
r.Route("/", func(r chi.Router) {
|
||||||
|
|
||||||
r.Use(middleware.Logger)
|
r.Use(middleware.Logger)
|
||||||
r.Use(middleware.Timeout(15 * time.Second))
|
r.Use(middleware.Timeout(15 * time.Second))
|
||||||
r.Use(middleware.Recoverer)
|
r.Use(middleware.Recoverer)
|
||||||
|
|
||||||
r.Get("/.well-known/acme-challenge/{token}", getACMEChallenges)
|
r.Get("/.well-known/acme-challenge/{token}", getACMEChallenges)
|
||||||
|
})
|
||||||
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,15 +29,18 @@ func RouteAdmin(authURL string, r chi.Router) {
|
||||||
|
|
||||||
authorizer = NewAuthorizer(authURL)
|
authorizer = NewAuthorizer(authURL)
|
||||||
|
|
||||||
|
r.Route("/", func(r chi.Router) {
|
||||||
r.Use(middleware.Logger)
|
r.Use(middleware.Logger)
|
||||||
//r.Use(middleware.Timeout(120 * time.Second))
|
//r.Use(middleware.Timeout(120 * time.Second))
|
||||||
r.Use(middleware.Recoverer)
|
r.Use(middleware.Recoverer)
|
||||||
|
|
||||||
|
/*
|
||||||
r.Use(func(next http.Handler) http.Handler {
|
r.Use(func(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
r.Mount("/ws", http.HandlerFunc(upgradeWebsocket))
|
r.Mount("/ws", http.HandlerFunc(upgradeWebsocket))
|
||||||
|
|
||||||
|
@ -114,6 +117,7 @@ func RouteAdmin(authURL string, r chi.Router) {
|
||||||
fmt.Println("Request Path:", r.URL.Path)
|
fmt.Println("Request Path:", r.URL.Path)
|
||||||
adminUI.ServeHTTP(w, r)
|
adminUI.ServeHTTP(w, r)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var apiNotFoundContent = []byte("{ \"error\": \"not found\" }\n")
|
var apiNotFoundContent = []byte("{ \"error\": \"not found\" }\n")
|
||||||
|
|
Loading…
Reference in New Issue