spring-projects / spring-projects/spring-security

Spring Security Headers servlet-api 6.1.0 Integration

Open
#18,801 0 comments 0 reactions 1 assignee View on GitHub

@rwinch is already working on this.

Since Feb 25, 2026.

in: web type: enhancement
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

In 6.1 the HttpServletResponse.setHeader method Javadoc was updated to state:

Passing null as the value removes all headers with the given name.

This means that we should be able to eagerly set all headers and if a single cache header is provided by the user, we can first clear the cache control headers set by security.

We should also be able to deprecate the OnCommitedResponseWrapper

We should provide this as an opt in feature.

In order to support this we will need to update HeaderWriter to be able to return a new request/response so that the cache writer can track the cache headers as a group and override them. Something like:

default ServletExchange writeHeaders(HttpServletRequest request, HttpServletResponse response) {
   writeHeaders(request, response);
   return new ServletExchange(wrap(request), wrap(response));
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.