feat: Add option to enable hsts header (#6147)

* feat: Add option to enable hsts header
* Update golden files
This commit is contained in:
Steven Masley
2023-02-10 10:52:49 -06:00
committed by GitHub
parent 77afdf71dc
commit 6189035e98
13 changed files with 287 additions and 1 deletions
+7
View File
@@ -485,6 +485,13 @@ func Server(vip *viper.Viper, newAPI func(context.Context, *coderd.Options) (*co
options.TLSCertificates = tlsConfig.Certificates
}
if cfg.StrictTransportSecurity.Value > 0 {
options.StrictTransportSecurityCfg, err = httpmw.HSTSConfigOptions(cfg.StrictTransportSecurity.Value, cfg.StrictTransportSecurityOptions.Value)
if err != nil {
return xerrors.Errorf("coderd: setting hsts header failed (options: %v): %w", cfg.StrictTransportSecurityOptions.Value, err)
}
}
if cfg.UpdateCheck.Value {
options.UpdateCheckOptions = &updatecheck.Options{
// Avoid spamming GitHub API checking for updates.