mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-01 02:12:50 +02:00
core/config: disable strict-transport-security header with staging autocert (#4741)
This commit is contained in:
parent
3ad72db2fb
commit
cfc339548f
2 changed files with 10 additions and 1 deletions
|
@ -1155,7 +1155,7 @@ func (o *Options) GetSetResponseHeadersForPolicy(policy *Policy) map[string]stri
|
|||
hdrs[k] = v
|
||||
}
|
||||
|
||||
if !o.HasCertificates() {
|
||||
if !o.HasCertificates() || o.AutocertOptions.UseStaging {
|
||||
delete(hdrs, "Strict-Transport-Security")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -979,6 +979,15 @@ func TestOptions_GetSetResponseHeaders(t *testing.T) {
|
|||
"X-XSS-Protection": "1; mode=block",
|
||||
}, options.GetSetResponseHeaders())
|
||||
})
|
||||
t.Run("autocert-staging", func(t *testing.T) {
|
||||
options := NewDefaultOptions()
|
||||
options.Cert = "CERT"
|
||||
options.AutocertOptions.UseStaging = true
|
||||
assert.Equal(t, map[string]string{
|
||||
"X-Frame-Options": "SAMEORIGIN",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
}, options.GetSetResponseHeaders())
|
||||
})
|
||||
t.Run("disable", func(t *testing.T) {
|
||||
options := NewDefaultOptions()
|
||||
options.SetResponseHeaders = map[string]string{DisableHeaderKey: "1", "x-other": "xyz"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue