Skip to content

Commit 622ddf3

Browse files
Copilotfletchto99
andcommitted
Document Configuration.disable! in README
Co-authored-by: fletchto99 <[email protected]>
1 parent 502ace7 commit 622ddf3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,27 @@ end
125125

126126
However, I would consider these headers anyways depending on your load and bandwidth requirements.
127127

128+
## Disabling secure_headers
129+
130+
If you want to disable `secure_headers` entirely (e.g., for specific environments or deployment scenarios), you can use `Configuration.disable!`:
131+
132+
```ruby
133+
if ENV["ENABLE_STRICT_HEADERS"]
134+
SecureHeaders::Configuration.default do |config|
135+
# your configuration here
136+
end
137+
else
138+
SecureHeaders::Configuration.disable!
139+
end
140+
```
141+
142+
When disabled, no security headers will be set by the gem. This is useful when:
143+
- You're gradually rolling out secure_headers across different customers or deployments
144+
- You need to migrate existing custom headers to secure_headers
145+
- You want environment-specific control over security headers
146+
147+
Note: When `disable!` is used, you don't need to configure a default configuration. The gem will not raise a `NotYetConfiguredError`.
148+
128149
## Acknowledgements
129150

130151
This project originated within the Security team at Twitter. An archived fork from the point of transition is here: https://github.com/twitter-archive/secure_headers.

0 commit comments

Comments
 (0)