How to handle chunked response in Jetty's transparent proxy servlet

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How to handle chunked response in Jetty's transparent proxy servlet


I'm using Jetty 9.4.9.v20180320. I have implemented Reverse Proxy by extending Transparent servlet. I have overridden rewriteTarget and filterServerResponseHeader methods

  public class ServicesProxyServlet extends Transparent {
private static final long   serialVersionUID    = 1L;

protected String rewriteTarget(HttpServletRequest request) {
    return rewrittenURI;

protected String filterServerResponseHeader(HttpServletRequest clientRequest, Response serverResponse, String headerName, String headerValue) {
    return super.filterServerResponseHeader(clientRequest, serverResponse, headerName, headerValue);

The destination server sends chunked response at given interval of time.

Now, it seems the Transparent proxy receives the whole response before sending it to client which causes the client timeout with 504 Gateway Timeout. If I removed filterServerResponseHeader the error still occurs.

I expect to send the chunked response to client without buffering it in Transparent proxy. This would avoid client timeout. How to flush the received data immediately in Transparent proxy? How to handle this?


jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit