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

HttpClient instance in the NettyRoutingFilter does not use the properties provided there #3692

Open
genie137 opened this issue Feb 11, 2025 · 0 comments

Comments

@genie137
Copy link

Describe the bug
Spring Cloud Gateway 4.2.0
JDK 21
Spring Boot 3.4.2

We were having some weird issues concerning connection timeouts. I was analzing some parts of the code and changing properties.
While doing this I noticed that the property 'spring.cloud.gateway.httpclient.connectTimeout' never reaches the actual NettyRoutingFilter.
The HttpClientProperties is being wired there, but when creating a httpClient for the acutal routing, the method getHttpClientMono uses the httpClient that is wired there also.
Only overwriting the connect-timeout set directly on the route, not using the global property.
Curous is that the response-timout property set in the same properties class, is used globally (NettyRoutingFilter L190).

This means that the global property is nog being usesd where it should.
I do see that the properties are being used in the HttpClientFactory, but that factory is not being used to create the HttpClients in the NettyRoutingFilter.

So i think there are two solutions possible:

  1. Use the connect-timeout property from the HttpClientProperties and apply that to the httpclient created in the NettyRoutingFilter. And let it be overwritten if a route specifically sets it.
  2. Use the HttpClientFactory to create the httpClients in the NettyRouting filter.

Essentially my problem boils down to the fact that i want a global connect-timeout, and not set the property seperately on all routes individualy.

Sample
Not applicable here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant