docs: document that SimpleClientHttpRequestFactory is not suitable for the WebMVC gateway#4203
Open
won-seoop wants to merge 1 commit into
Open
Conversation
…n WebMVC gateway spring-cloudGH-3451: HttpURLConnection (used by SimpleClientHttpRequestFactory) throws exceptions on 4xx/5xx responses instead of returning the response, causing the gateway to forward a 500 instead of the actual downstream status. Added an "HTTP Client" section to how-it-works.adoc documenting: - Supported clients (Apache HC5, Jetty, JDK HttpClient) in priority order - explicit spring.http.clients.imperative.factory property - WARNING that SimpleClientHttpRequestFactory is unsupported and why Closes spring-cloudgh-3451 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #3451
SimpleClientHttpRequestFactory(backed byjava.net.HttpURLConnection) is incompatible with Spring Cloud Gateway Server MVC.HttpURLConnectionthrows exceptions (e.g.FileNotFoundException,IOException) on 4xx/5xx responses rather than returning the response body, so the gateway cannot forward the downstream status to the client and falls back to a500 Internal Server Error.The fix is to use one of the supported HTTP client libraries instead. Added a new
[[gateway-http-client]]section tohow-it-works.adocthat documents:spring.http.clients.imperative.factoryproperty for explicit selectionWARNINGcallout explaining whySimpleClientHttpRequestFactoryfails and how to avoid itTest plan
spring.http.clients.imperative.factoryvalues (apache,jetty,jdk) match whatGatewayHttpClientEnvironmentPostProcessoraccepts