spring-cloud / spring-cloud/spring-cloud-gateway
AddRequestHeader/SetRequestHostHeader is adding multiple Forwarded: <Filtered> which is giving 431-request headers field too large
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
Hi Folks,
I am using Spring boot starter -3.4.4 and Spring cloud dependencies version 2024.0.1.
I have created two routes in application.yaml:
- route 1 is where I want to add request headers to the incoming requests which match the path predicate. For this I am using AddRequestHeaderIfNotPresent=X-Custom_header:custom_value.
- route 2 is where I want to replace the host from http://localhost:8080 to https//some-domian.com for which I am using SetRequestHostHeader.
In both the cases I am getting Http headers is larger than 16384 bytes and getting 431 http status code, where Forwarded: is coming multiple times in the error.
Please let me know if it is a bug in existing version or I am missing some configuration.
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 reproducing the two application.yaml routes using AddRequestHeaderIfNotPresent and SetRequestHostHeader with the stated Spring Boot 3.4.4 and Spring Cloud 2024.0.1 versions. Trace how the Forwarded header is produced across both filters and verify the request-header size; done means identifying whether configuration causes the duplication or isolating a reproducible gateway bug.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100