mirror of
https://github.com/1f349/violet.git
synced 2024-11-21 10:51:40 +00:00
Add HSTS header
This commit is contained in:
parent
1194717a32
commit
37b0617e78
@ -27,7 +27,10 @@ func NewHttpsServer(conf *conf.Conf) *http.Server {
|
||||
|
||||
return &http.Server{
|
||||
Addr: conf.HttpsListen,
|
||||
Handler: rateLimiter,
|
||||
Handler: http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||
rw.Header().Set("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
|
||||
rateLimiter.ServeHTTP(rw, req)
|
||||
}),
|
||||
TLSConfig: &tls.Config{GetCertificate: func(info *tls.ClientHelloInfo) (*tls.Certificate, error) {
|
||||
// error out on invalid domains
|
||||
if !conf.Domains.IsValid(info.ServerName) {
|
||||
|
Loading…
Reference in New Issue
Block a user