webhookd/pkg/middleware/hsts.go

14 lines
335 B
Go
Raw Normal View History

package middleware
import (
"net/http"
)
// HSTS is a middleware to enabling HSTS on HTTP requests
func HSTS(inner http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Strict-Transport-Security", "max-age=15768000 ; includeSubDomains")
2020-08-20 12:32:44 +00:00
inner.ServeHTTP(w, r)
})
}