spring-cloud / spring-cloud-gateway

An API Gateway built on Spring Framework and Spring Boot providing routing and more.
http://cloud.spring.io
Apache License 2.0
4.5k stars 3.31k forks source link

ProxyExchange discards all incoming request headers when making a request with a body. #2559

Open ericyanush opened 2 years ago

ericyanush commented 2 years ago

Affects: spring-cloud-gateway-webflux:3.1.1


Setup Define an MVC RestController that accepts a ProxyExchange as an argument to a request handler method, and use the ProxyExchange object to issue a POST request (or any request that contains a body) to an upstream service, using a body created (or manipulated) in the request handler method.

Expected Behaviour The ProxyExchange forwards the original request headers, minus filtered sensitive headers, and Content related headers in the upstream request.

Observed Behaviour The ProxyExchange discards all original incoming headers, appending only the X-Forwarded-For and X-Forwarded-Proto headers. This behaviour is in contrast to the behaviour observed when using a ProxyExchange object to make requests to upstream services that do not contain bodies (GET, OPTIONS, etc).

sandipchitale commented 1 year ago

Any update on this?

NadChel commented 6 months ago

Could you share your controller please?