spring-cloud / spring-cloud/spring-cloud-gateway

Request headers can not be modified after request pass through ModifyRequestBodyGatewayFilter

Open
#2,548 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation help wanted
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.
image

I am not sure this is an issue or it's a mistake about my usage.

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.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.