-
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
AsyncProxyServlet calls onProxyResponseSuccess() when internally it throws "Response header too large" exception #5685
Comments
@arshadwkhan can you attach any stack traces that you have, as that will make it easier to replicate. |
@arshadwkhan not yet. Other priorities sorry. But just to clarify the scenario:
I think this is because How big is the response body? Would it likely overflow a buffer and cause the response to the client to be committed during transfer of the body, or is it smallish, and thus we'd only discover the too large header once the handling is over and we try to commit? So if I'm reading this right, the code in Eitherway, it is a difficult case where there error happens after the proxy app says it is finished with the request/response. We'll have to do some experiments to see. I probably wont have time to look at this in detail until next week. |
I think OnProxyResponseSuccess() is called after a response is committed to the client. It sends http status 500 to the client. Here is the call stack when header overflow is detected.
process:761, HttpConnection$SendCallback (org.eclipse.jetty.server) |
@gregw any update on this issue ? This looks like a defect. Can you please confirm ? |
Sorry, we've not looked at this as we have other priorities. |
@joakime thanks for the update. Can you please convert this to defect ? The underlying layer eats up the error and sends http status 500 to the client but reports http status 200 to asyncservlet. |
This issue has been automatically marked as stale because it has been a |
This issue has been automatically marked as stale because it has been a |
This issue has been automatically marked as stale because it has been a |
…nternally it throws "Response header too large" exception. * Introduced "maxResponseHeadersSize" parameter to AbstractProxyServlet. * Introduced HttpGenerator.maxResponseHeadersSize and added checks to not exceed it. * Fixed HttpParser to generate a 400 in case HttpParser.maxHeaderBytes are exceeded for a response. * HTTP2Flusher now resets streams in case of failures. * Removed cases in HTTP2Session where a GOAWAY frame was generated with lastStreamId=0. GOAWAY.lastStreamId=0 means that not a single request was processed by the server, which was obviously incorrect. * Written tests for both ProxyHandler and ProxyServlet about max response headers size exceeded. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
FTR, the behavior reported is expected (in Jetty 12). The logs show that the server generator is not able to generate a response due to the response headers being too large. This failure is detected and handled, and since the response has not been committed, an error response is generated, which results in a 500. The response 500 is a perfectly valid HTTP response, and that's why However, this issue uncovered a few glitches in Jetty 12, which have been addressed in #12351. Sorry for the long time to get this issue looked at! |
…nternally it throws "Response header too large" exception. (#12351) * Introduced "maxResponseHeadersSize" parameter to AbstractProxyServlet. * Introduced HttpGenerator.maxResponseHeadersSize and added checks to not exceed it. * Fixed HttpParser to generate a 400 in case HttpParser.maxHeaderBytes are exceeded for a response. * HTTP2Flusher now resets streams in case of failures. * Removed cases in HTTP2Session where a GOAWAY frame was generated with lastStreamId=0. GOAWAY.lastStreamId=0 means that not a single request was processed by the server, which was obviously incorrect. * Written tests for both ProxyHandler and ProxyServlet about max response headers size exceeded. * Simplified server-side response header allocation for HTTP/1.1. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Jetty version
9.4.30
Java version
8
OS type/version
Mac
Description
I am using embedded jetty version 9.4.30 and use AsyncProxyServlet to reverse proxy request to the server. When the server returns a very large header, AsyncProxyServlet calls onProxyResponseSuccess() with proxyResponse.status=200 even though the servlet sends http status 500 to the client. Is it possible to detect "Response header too large" error in AsyncProxyServlet ?
The text was updated successfully, but these errors were encountered: