webhookd/pkg/middleware/hsts.go
Nicolas Carlier 6b3623f67a feat(api): refactore router
- Simplify router
- Single routes onfiguration file
- Improve HTTP logger
2021-07-11 13:09:44 +02:00

14 lines
335 B
Go

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")
inner.ServeHTTP(w, r)
})
}