We have an Apache comet servlet on the Tomcat 8 server for the long-polling connection as below.
public class Connect extends HttpServlet implements CometProcessor {
public void event(CometEvent event) throws IOException, ServletException {
HttpServletRequest request = event.getHttpServletRequest();
HttpServletResponse response = event.getHttpServletResponse();
if (event.getEventType() == CometEvent.EventType.BEGIN) {
event.setTimeout(300000);
...
} else if (event.getEventType() == CometEvent.EventType.ERROR) {
event.close();
} else if (event.getEventType() == CometEvent.EventType.END) {
event.close();
}
}
}
And the connector of the Tomcat8 server.xml as below
<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="90000"
redirectPort="8443" URIEncoding="UTF-8"/>
The comet connection will be timeout after 300 seconds. This is worked when client is trying to connect to the Tomcat directly.(http://IP:8080/Connect).
However, if we set up an Apache reverse proxy, the connection will always be timeout after 60 seconds. The Apache proxypass setting as below
ProxyTimeout 310
ProxyPass /Connect http://localhost:8080/Connect connectiontimeout=60 timeout=310 keepalive=On ttl=350
ProxyPassReverse /Connect http://localhost:8080/Connect
How can we make the long-polling connection works on the reverse proxy?
Thanks