HttpClient instance in the NettyRoutingFilter does not use the properties provided there
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:
- 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.
- 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.