Skip to content

docs: document that SimpleClientHttpRequestFactory is not suitable for the WebMVC gateway#4203

Open
won-seoop wants to merge 1 commit into
spring-cloud:mainfrom
won-seoop:doc-3451-simpleclienthttprequestfactory-warning
Open

docs: document that SimpleClientHttpRequestFactory is not suitable for the WebMVC gateway#4203
won-seoop wants to merge 1 commit into
spring-cloud:mainfrom
won-seoop:doc-3451-simpleclienthttprequestfactory-warning

Conversation

@won-seoop

Copy link
Copy Markdown
Contributor

Summary

Closes #3451

SimpleClientHttpRequestFactory (backed by java.net.HttpURLConnection) is incompatible with Spring Cloud Gateway Server MVC. HttpURLConnection throws 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 a 500 Internal Server Error.

The fix is to use one of the supported HTTP client libraries instead. Added a new [[gateway-http-client]] section to how-it-works.adoc that documents:

  • The three supported HTTP clients (Apache HC5, Jetty, JDK HttpClient) and their classpath-based priority order
  • The spring.http.clients.imperative.factory property for explicit selection
  • A WARNING callout explaining why SimpleClientHttpRequestFactory fails and how to avoid it

Test plan

  • Docs build with Antora renders the new section without errors
  • Verify spring.http.clients.imperative.factory values (apache, jetty, jdk) match what GatewayHttpClientEnvironmentPostProcessor accepts

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document that SimpleClientHttpRequestFactory (and URLConnection which it uses) is not suitable for the WebMVC gateway server.

2 participants