Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why Remove Content-Length in Gateway MVC? #3308

Closed
sunhao1256 opened this issue Mar 19, 2024 · 4 comments
Closed

Why Remove Content-Length in Gateway MVC? #3308

sunhao1256 opened this issue Mar 19, 2024 · 4 comments

Comments

@sunhao1256
Copy link
Contributor

sunhao1256 commented Mar 19, 2024

Describe the bug
I communicate with downstream server , At beginning I send request with okhttp manutally and everything is ok , when i integrate spring gateway mvc,i got 500 error like form encode escape % etc. after i dive into deep code , i found an odd Request Filter RemoveContentLengthRequestHeadersFilter

why we need remove content-lengh ,i can't understand the meaning of the comment on top.

// jdk http clients seem to not like having this copied from the initial request. // urlconnection fails with form url encoded

@spencergibb
Copy link
Member

The jdk http client will fail with an error if not removed.

@spring-cloud-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-cloud-issues
Copy link

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@jensmatw
Copy link
Contributor

The jdk http client will fail with an error if not removed.

What error will occur, maybe I can invstigate a bit if I know the error? I think it is a big problem if (in case of mvc) the ´Content-Lengthis just removed. For my project, after migrating to mvc, I set the remove-content-length-request-headers-filter.enabled to false with having only one issue with a 3rd party service which raises a strange exception, all my other downstream services are working fine (and one of them really needsContent-Length`).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants