spring-cloud / spring-cloud/spring-cloud-netflix

Only request bodies with content-type multipart/* and application/x-www-form-urlencoded work

Open
#3,418 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Java
Stars
5k
Forks
2.5k
Avg merge
1d 2h
Merged PRs (30d)
10

Description

Make a request through zuul using a POST or PUT verb with a content-type that is not multipart/* or application/x-www-form-urlencoded`

When Zuul makes the request to the backend, it won't include the request body.

The reason is that the original request body is consumed in org.springframework.cloud.netflix.zuul.filters.TraceProxyRequestHelper.debug(String, String, MultiValueMap<String, String>, MultiValueMap<String, String>, InputStream) leaving no request body to consume when org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilter actually sends the request.

Requests of content-type application/x-www-form-urlencoded work because org.springframework.cloud.netflix.zuul.filters.pre.FormBodyWrapperFilter gets the body. Requests of type multipart/* work because org.springframework.cloud.netflix.zuul.filters.ProxyRequestHelper.shouldDebugBody(RequestContext) explicitly excludes them.

To reproduce the issue, just make a request through zuul with a Content-Type of text/plain, for example, and you'll always get a time out error as the backend server will keep waiting for response body that it will never get.

I believe this issue was originally reported at https://github.com/spring-cloud/spring-cloud-netflix/issues/2610

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with TraceProxyRequestHelper.debug and SimpleHostRoutingFilter, then compare the handling in FormBodyWrapperFilter and ProxyRequestHelper.shouldDebugBody. Reproduce the issue with a POST or PUT using Content-Type text/plain and confirm that the backend receives the request body instead of timing out.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.