docs: document that SimpleClientHttpRequestFactory is not suitable for WebMVC gateway#4196
Open
won-seoop wants to merge 1 commit into
Open
docs: document that SimpleClientHttpRequestFactory is not suitable for WebMVC gateway#4196won-seoop wants to merge 1 commit into
won-seoop wants to merge 1 commit into
Conversation
…r WebMVC gateway Add a new http-client.adoc page for the WebMVC gateway documenting: - An IMPORTANT warning that SimpleClientHttpRequestFactory (URLConnection) cannot correctly forward 4xx/5xx responses and causes HTTP 500 errors - How to configure a suitable HTTP client factory via spring.http.clients.imperative.factory (jdk, okhttp, or apache) - Add the new page to nav.adoc The root cause: URLConnection throws IOException for error status codes, preventing the gateway from reading and forwarding the upstream error body. Any of JDK HttpClient, OkHttp, or Apache HttpComponents handle this correctly. Closes spring-cloud#3451 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
|
|
spencergibb
requested changes
Jun 9, 2026
|
|
||
| Use one of the following supported implementations: | ||
|
|
||
| === JDK HttpClient (recommended, no extra dependency) |
Member
There was a problem hiding this comment.
This does not need to be done as it is the default
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.
Problem
When using Spring Cloud Gateway Server MVC with the default
SimpleClientHttpRequestFactory(backed byjava.net.HttpURLConnection), upstream 4xx/5xx responses are not forwarded correctly — the gateway returns HTTP 500 instead of the actual error status. This happens becauseURLConnectionthrows ajava.io.IOExceptionfor non-2xx responses instead of making the response body available.This was identified in #3451 and documented as a known limitation by the team:
Changes
Add a new
http-client.adocpage underspring-cloud-gateway-server-webmvc/:SimpleClientHttpRequestFactory/URLConnectionis not suitablespring.http.clients.imperative.factory(values:jdk,okhttp,apache)Also adds the new page to
nav.adoc.Closes #3451
🤖 Generated with Claude Code