-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Description
I am facing a problem in conjunction with the Spring Cloud Gateway. After upgrading to Spring Boot 4 every POST request contains duplicates of the content-type header. My setup is a web client calls a spring boot backend with spring cloud gateway and subsequently another backend is called
I tried to debug and perhaps the problem is in the area of the org.springframework.http.HttpHeaders class, but not sure.
@rstoyanchev : I found some comments from you on other issues for this topic area. So I mention you here.
Perhaps the issue #36357 is something similar.
Currently used versions:
- spring boot 4.0.3
- spring framework 7.0.5
- spring-cloud-starter-gateway-server-webmvc 5.0.1
Example requests
Frontend/client http request
POST /backend/v2/admin/remoteconfig HTTP/1.1
Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: de;q=0.7
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 51
Content-Type: application/json
Cookie: **********
Host: localhost:4200
Origin: http://localhost:4200
Pragma: no-cache
Referer: http://localhost:4200/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Sec-GPC: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
sec-ch-ua: "Not:A-Brand";v="99", "Brave";v="145", "Chromium";v="145"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Linux"
The erroneous request, as it comes out at spring boot cloud gateway and rejected by the downstream backend. The content-type header is duplicated.
POST /api/v2/admin/remoteconfig HTTP/1.1
host: localhost:8080
transfer-encoding: chunked
sec-fetch-mode: cors
referer: http://localhost:4200/
sec-fetch-site: same-origin
accept-language: de;q=0.7
cookie: ***********
swm_hp_user: *********
origin: http://localhost:4200
swm_hp_roles: *********
pragma: no-cache
accept: application/json, text/plain, */*
sec-gpc: 1
sec-ch-ua: "Not:A-Brand";v="99", "Brave";v="145", "Chromium";v="145"
sec-ch-ua-mobile: ?0
swm_hp_apikey: **********
sec-ch-ua-platform: "Linux"
content-type: application/json;charset=UTF-8
content-type: application/json;charset=UTF-8
cache-control: no-cache
accept-encoding: gzip, deflate, br, zstd
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
sec-fetch-dest: empty
Thank you in advance for your support.