Closed meletis closed 6 months ago
This has to do with the JDK HttpClient
:-(
Using this system property:
-Djdk.httpclient.HttpClient.log=errors,requests,headers,frames:all,content,ssl,trace,channel
I see this being sent
2024-03-11T17:19:13.746-04:00 INFO 81163 --- [demogatewaymedreqbodygh3265] [ient-1-Worker-0] jdk.httpclient.HttpClient : HEADERS: HEADERS FRAME (stream=1)
:authority: httpbin.org
:method: POST
:path: /post
:scheme: https
accept: application/json, */*;q=0.5
accept-encoding: gzip, deflate
Content-Type: application/json;charset=UTF-8
Forwarded: proto=http;host="localhost:8080";for="[0:0:0:0:0:0:0:1]:54434"
Host: localhost:8080
user-agent: HTTPie/3.2.2
X-Forwarded-For: 0:0:0:0:0:0:0:1
X-Forwarded-Host: localhost:8080
X-Forwarded-Port: 8080
X-Forwarded-Proto: http
So this must be something with httpbin specifically because the JDK HttpClient
is sending the correct header.
Thank you, @spencergibb , for the feedback, that explains it!
I configured the following route with Gateway MVC.fn:
When I test it with http://localhost:8080/headers, then I correctly get that the
Host
header has the valuelocalhost
:Then I change the route configuration to target
https
instead ofhttp
:When I tested again, the remote application is receiving a
Host
header with valuehttpbin.org
:However, I would expect the
Host
header on the application side to continue to belocalhost
, since thepreserveHostHeader()
filter is used.I took a look in the code but couldn't find any flaws, so I feel like I'm missing something, although this does look like a bug to me.