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