You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I POST JSON data to a proxy controller that contains a space character, the proxy exchange fails with the exception in the title:
java.io.IOException: insufficient data written
at java.base/sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.close(HttpURLConnection.java:3848) ~[na:na]
at org.springframework.http.client.SimpleClientHttpRequest.executeInternal(SimpleClientHttpRequest.java:84) ~[spring-web-6.1.6.jar:6.1.6]
at org.springframework.http.client.AbstractStreamingClientHttpRequest.executeInternal(AbstractStreamingClientHttpRequest.java:70) ~[spring-web-6.1.6.jar:6.1.6]
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:66) ~[spring-web-6.1.6.jar:6.1.6]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:889) ~[spring-web-6.1.6.jar:6.1.6]
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:740) ~[spring-web-6.1.6.jar:6.1.6]
at org.springframework.cloud.gateway.mvc.ProxyExchange.exchange(ProxyExchange.java:347) ~[spring-cloud-gateway-mvc-4.1.2.jar:4.1.2]
at org.springframework.cloud.gateway.mvc.ProxyExchange.post(ProxyExchange.java:308) ~[spring-cloud-gateway-mvc-4.1.2.jar:4.1.2]
at com.mindhaq.demogatewayproxy.GatewayController.handlePost(GatewayController.kt:17) ~[main/:na]
....
With everything being the same, but not having any space characters in the JSON, there is no problem.
This was found while migrating a spring-boot monolith running on boot 2.2.x with netflix zuul which was updated to spring boot 3.2.x, cloud gateway, latest JDK etc. It took quite some time to reduce the error scenario to this.
Sample
I created a sample repository which proxies requests to httpbin.org
Describe the bug
I'm using spring-boot 3.2.5 with spring cloud 2023.0.1 and JDK 21
I'm using Proxy Exchange Gateway with Spring MVC.
When I POST JSON data to a proxy controller that contains a space character, the proxy exchange fails with the exception in the title:
With everything being the same, but not having any space characters in the JSON, there is no problem.
This was found while migrating a spring-boot monolith running on boot 2.2.x with netflix zuul which was updated to spring boot 3.2.x, cloud gateway, latest JDK etc. It took quite some time to reduce the error scenario to this.
Sample
I created a sample repository which proxies requests to httpbin.org
https://github.com/mindhaq/spring-demo-gateway-proxyexchange-mvc
This request fails with the exception above:
This one works just fine:
Going directly to httpbin.org works in both cases, so that is not the problem.
Do I miss any configuration or is this some deeper lying bug which got revealed by that space character?
The text was updated successfully, but these errors were encountered: