In a simple @EnableZuulProxy
application, requests with Content-Type application/x-www-form-urlencoded
or multipart/form-data
gets wrapped in a FormBodyRequestWrapper
by FormBodyWrapperFilter
. This decodes the content and reencode it for the backend.
However, from what I can see, requests of other content types (let's say application/json
) in a service discovery enabled route will get their InputStream
directly proxied to the client used through the RibbonCommandContext
.
In Apache HttpClient
for example, the input stream will be wrapped in a BasicHttpEntity
in the RibbonApacheHttpRequest
.
Why is this necessary? Couldn't we just handle all requests the same way?
See https://github.com/spring-cloud/spring-cloud-netflix/issues/109 for the original issue.
The zuul request wrapper buffers the request and it needed to be added back for the proxy. This is one of the reasons spring cloud gateway was built, since it doesn't have these problems.