get acme-challenges over https too
This commit is contained in:
parent
ebce63c08e
commit
e63b99d49b
|
@ -33,7 +33,12 @@ func RouteStatic(r chi.Router) chi.Router {
|
||||||
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}", func(w http.ResponseWriter, r *http.Request) {
|
r.Get("/.well-known/acme-challenge/{token}", getACMEChallenges)
|
||||||
|
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
func getACMEChallenges(w http.ResponseWriter, r *http.Request) {
|
||||||
//token := chi.URLParam(r, "token")
|
//token := chi.URLParam(r, "token")
|
||||||
host := r.Host
|
host := r.Host
|
||||||
if strings.ContainsAny(host, "/:|\\") {
|
if strings.ContainsAny(host, "/:|\\") {
|
||||||
|
@ -43,9 +48,6 @@ func RouteStatic(r chi.Router) chi.Router {
|
||||||
|
|
||||||
fsrv := http.FileServer(http.Dir(tokenPath))
|
fsrv := http.FileServer(http.Dir(tokenPath))
|
||||||
fsrv.ServeHTTP(w, r)
|
fsrv.ServeHTTP(w, r)
|
||||||
})
|
|
||||||
|
|
||||||
return r
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func RouteAll() chi.Router {
|
func RouteAll() chi.Router {
|
||||||
|
@ -74,6 +76,8 @@ func RouteAll() chi.Router {
|
||||||
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.Route("/api", func(r chi.Router) {
|
r.Route("/api", func(r chi.Router) {
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue