webhookd/pkg/middleware/hsts.go
2020-01-28 20:00:42 +00:00

14 lines
320 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")
return
})
}