Welcome to mirror list, hosted at ThFree Co, Russian Federation.

middleware.go « acme « internal - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: faa2a0177a0253d76b9b4b682b8f5d2e5a7fa44e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package acme

import (
	"net/http"
	// TODO: break this dependency too
	d "gitlab.com/gitlab-org/gitlab-pages/internal/domain"
)

// AcmeMiddleware handles ACME challenges
func (m *Middleware) AcmeMiddleware(handler http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		domain := d.FromRequest(r)

		if m.ServeAcmeChallenges(w, r, domain) {
			return
		}

		handler.ServeHTTP(w, r)
	})
}