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

Trusted upstream forwarded headers are dropped when forwarded filter is disabled

Open
#4,227 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

for team discussion
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

Describe the bug

In version 2025.1.2 / 2025.0.3 a new filter was added to remove existing forwarded headers when the gateway does not have forwarding support enabled, or does not trust upstream proxies. However this broke my k8s setup:

  • an edge api gateway which adds forwarded headers
  • a second gateway, downstream from edge, which is used to route requests to different containers in the same pod
  • a container in the same pod as the internal gateway

In this setup the internal gateway does not add forwarded headers, as they would only refer to internal resources, and they are not relevant. It, however, trusts the upstream edge gateway.

In previous versions this worked as expected, but it broke with the last update.

Is this behavior intended (perhaps as part of CVE-2026-47825)? If so, what is the correct way to support use cases like mine?

Sample

https://github.com/gbaso/spring-cloud-gateway-forwarded

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

Reproduce the reported Kubernetes topology using the sample project at https://github.com/gbaso/spring-cloud-gateway-forwarded and compare behavior across the affected versions. Start by tracing the forwarded-header filter and its trust configuration; done means the handling of trusted upstream headers is verified and covered for this setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.