spring-cloud / spring-cloud/spring-cloud-gateway
Request headers can not be modified after request pass through ModifyRequestBodyGatewayFilter
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
Describe the bug
Spring cloud version:3.0.3
I am using ModifyRequestBodyGatewayFilter to cache request body, but when request pass through ModifyRequestBodyGatewayFilter, heads can not be modified any more, at opposite, headers can be modified before ModifyRequestBodyGatewayFilter.
I guess this problem happened because decorate method from ModifyRequestBodyGatewayFilterFactory. Spring cloud gateway user can not get new headers from MutatedServerHttpRequest but can only get header from the time point when decorate method be called.

I am not sure this is an issue or it's a mistake about my usage.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ModifyRequestBodyGatewayFilterFactory's decorate method and the MutatedServerHttpRequest behavior described in the report. Reproduce the difference between modifying headers before and after ModifyRequestBodyGatewayFilter, then determine whether the observed header visibility is a defect or a usage mistake.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100