-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
AsyncMiddleManServlet removes content-length header if the client doesn't send Expect: 100-Continue #9758
Comments
It is a bug that we keep the With that fixed, the behavior will be the same: if the proxy can read the whole client request content in one read, then the proxy request to the server will have Would that solve this issue? |
Hi Simone, In our use case, we know the size of the transformed request up front since we're only adding metadata to the body, so we can add the content-length header before we've read the client request. The issue we faced is that the downstream expects the content-length header so it can adjust how it handles the request based on the size. We worked around the issue by copying the code and modifying it. |
Can you detail what code you have modified? |
I copied the AsyncMiddleManServlet and removed that line. That was the only change needed. We were looking at the middle man servlet as an option, but we've since moved to reactor netty with webflux so I wouldn't worry about changing this for us unless you think it's the right change. |
This issue has been automatically marked as stale because it has been a |
Jetty version
10.0.15
Java version
17.0.3
Question
Hi Jetty,
The
AsyncMiddleManServlet.ProxyReader
removes the content-length header and switches to chunked encoding when proxying.I initially thought this was because you don't know the length of the transformed request, but I noticed that it only does this when the client doesn't send
Expect: 100-Continue
and otherwise keeps the content length header.Do you know why this difference in behaviour exists? It would be possible to change the headers in
copyRequestHeaders
myself if the content length is unknown without enforcing it in the reader.I can extend the
ProxyReader
impl to change this behaviour, but it's a significant amount of code that needs to be copied to make a very small behaviour change.The text was updated successfully, but these errors were encountered: