Add STS header when TLS

This commit is contained in:
Cédric Krier 2015-02-09 19:53:52 +01:00
parent 66cf15d2d9
commit a5218b38a6

View file

@ -22,6 +22,9 @@ func SetHeaders(c *web.C, h http.Handler) http.Handler {
w.Header().Add("Cache-Control", "value")
w.Header().Set("Last-Modified", time.Now().UTC().Format(http.TimeFormat))
w.Header().Set("Expires", "Thu, 01 Jan 1970 00:00:00 GMT")
if (r.TLS != nil) {
w.Header().Add("Strict-Transport-Security", "max-age=31536000")
}
h.ServeHTTP(w, r)
}
return http.HandlerFunc(fn)