Skip to content

Handling of ResponseStatusException to also include setting of response headers #23741

Closed
@Zabelinski-Andrey

Description

@Zabelinski-Andrey

Affects: 5.1.10
Spring RestController offers a nice function, one could filter requests by methods. E.g.:

@RequestMapping(value = "/some-pattern", method = {RequestMethod.GET, RequestMethod.HEAD})
public Mono<Void> handler(...)

If a request matches the path pattern but does not match the method pattern spring-web automatically generates a response 405 Method Not Allowed which is perfectly fine.

But RFC 7231 Explicitly requires servers to include the Allow header (https://tools.ietf.org/html/rfc7231#page-59):
The origin server MUST generate an Allow header field in a 405 response containing a list of the target resource's currently supported methods.

It request method filters must automatically insert an Allow header with a list of allowed methods into a response.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions