Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling rest endpoint with x-forwarded-host and native forward headers strategy set causes malformed URI #34395

Closed
msosa opened this issue Feb 27, 2023 · 1 comment
Labels
for: external-project For an external project and not something we can fix

Comments

@msosa
Copy link

msosa commented Feb 27, 2023

Hi,

My project is using server.forward-headers-strategy: native to apply some x-forward headers. I just upgraded my project to Spring Boot 3.0.3 and am now seeing all my requests with an x-forwarded-host header of localhost:3000 fail with this error

2023-02-27T22:47:30.782+08:00 DEBUG 21608 --- [ctor-http-nio-3] o.s.h.s.r.ReactorHttpHandlerAdapter      : Failed to get request URI: Malformed IPv6 address at index 8: http://[localhost:3000]:3000

I have made a sample repo to show the problem. I tried making a test to show the failure, but the test seems to take a different path then when calling the server directly via postman. You will need to add some headers to postman(curl will also likely work) which are described in the readme.

This works as expected when either using 3.0.2, changing the headers strategy to framework, or just removing the forwarded host header. It does seem that the non problematic calls do not use ReactorHttpHandlerAdapter but rather use HttpWebHandlerAdapter instead.

It does seem weird to me that the port is also included in the x-forwarded-host but there doesn't seem to be a standard way of doing these headers, and that is how the frontend library I am using sets them that way.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 27, 2023
@wilkinsona
Copy link
Member

We believe this is another symptom of the problem that's causing spring-projects/spring-framework#30033. Please subscribe to that Framework issue and follow up there as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

3 participants