Skip to content

Add option to disable all secure headers - #4284

Open
elgamal-ahmed wants to merge 1 commit into
spring-cloud:mainfrom
elgamal-ahmed:gh-2932-disable-all-secure-headers
Open

elgamal-ahmed wants to merge 1 commit into
spring-cloud:mainfrom
elgamal-ahmed:gh-2932-disable-all-secure-headers

Conversation

@elgamal-ahmed

@elgamal-ahmed elgamal-ahmed commented Sep 12, 2026

Copy link
Copy Markdown

Adds disable: all support for the SecureHeaders filter so every secure header can be disabled without listing them individually.

This applies to both global configuration and route filter arguments. The setting also takes precedence over explicitly enabled optional headers, while preserving any headers already present on the response.

Fixes gh-2932.

Signed-off-by: elgamal-ahmed <83829864+elgamal-ahmed@users.noreply.github.com>
@elgamal-ahmed
elgamal-ahmed force-pushed the gh-2932-disable-all-secure-headers branch from 19b7d31 to a111478 Compare September 12, 2026 17:03
@spencergibb

Copy link
Copy Markdown
Member

Couldn't you just disable the filter?

@elgamal-ahmed

Copy link
Copy Markdown
Author

Couldn't you just disable the filter?

Yeah, that's fair. The filter's opt-in, so if you're not using it there's nothing to disable anyway.

The scenario I had in mind is when SecureHeaders is set up as a default filter and you want it off for one environment or profile. You can do that with enabled: false, but that's a hard off since it drops the factory bean, so any route that still references SecureHeaders stops resolving. With disable: all the filter stays wired up and just doesn't add anything, so you can flip it in a single application-.yml without touching the filter list. It also won't quietly miss any new default headers that get added later, which was the main thing the original issue was asking for.

That said, your call. If you don't think it's worth the extra config, I'm fine closing it.

@spencergibb

Copy link
Copy Markdown
Member

No, good point with default filters and then per route exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide an easy method to disable all secure-headers

3 participants