Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] How to handle chunked response in Jetty's transparent proxy servlet

Hello,

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;

@Override
protected String rewriteTarget(HttpServletRequest request) {
        ...
    return rewrittenURI;
}

@Override
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?



--
Regards
Malini

Back to the top