-
Notifications
You must be signed in to change notification settings - Fork 549
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
Spring Cloud Gateway throwing "hostname can't be null" based on my request only having headers and not multi-value headers #816
Comments
Update: I think the problem is that I interpreted that out-of-the-box this supports ALB messages (as well as API GW), but reading the |
Thank you for raising this @tc2-c1 . If the Hostname only appears on singlevalueHeaders for ALB, then we should update the method to account for that. I will send a fix by the end of the day. Thanks again |
Thanks @mbfreder , the response is massively appreciated 🙏 I have noticed that this line: |
Released as part of 2.0.2 |
Serverless Java Container version:
com.amazonaws.serverless:aws-serverless-java-container-springboot3:2.0.0
Implementations:
Spring Cloud gateway
Framework version:
org.springframework.cloud:spring-cloud-starter-gateway:4.1.1
Frontend service:
ALB
Deployment method:
localstack
Scenario
I am attempting to run Spring Cloud Gateway in a lambda environment, using AWS's Serverless Java container for Spring Boot 3. I am deploying with localstack locally and hitting it with requests.
I have a
/health
endpoint:which works as expected (I get a 200 OK back).
However, hitting one of my gateway endpoints I get the following
InetSocketAddress
I've tracked this down to:
HttpServletRequest
for a hostAwsProxyHttpServletRequest
'sAwsProxyRequest
asking for a multi-value header describing hostHowever, using debugging I can see I only have headers rather than multi-value headers:
meaning
.getHeaders().getFloorEntry("Host").getValue()
is more likely what I need.Does anyone here have advice on how to work the problem?
Expected behavior
Proxy requests should work and return my request.
Actual behavior
There is an exception when looking up a hostname due to it being
null
, based on the request I am sending into my service.Steps to reproduce
n/a, but the app is currently very vanilla (so I don't think there is anything getting in the way). I have 3 beans, 1 for health (above) and 2 that do the pre/post proxy request logging. Nothing else is present in the service.
Full log output
The text was updated successfully, but these errors were encountered: