tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: CometProcessor proxied through Apache httpd
Date Wed, 27 Jan 2010 15:49:42 GMT
On 01/27/2010 08:26 AM, Stephen Byrne wrote:
> Is there a way to get CometProcessor to work when proxying through 
> Apache httpd? Here is what I have tried:
>
> I have an HttpServlet implementing CometProcessor.
>
> When I have a Tomcat connector like this:
>
> <Connector port="8912" protocol="HTTP/1.1"
>   address="192.168.1.30" />
>
> and I connect to it directly, everything works wonderfully - I get 
> CometEvent.EventType.READ events as I send data from the client.

correct
>
>
> When I have a Tomcat connector like this:
>
> <Connector port="8911" protocol="HTTP/1.1"
>   address="127.0.0.1" />
>
> and have Apache httpd proxy requests like this:
>
> RewriteRule ^/path/to/servlet http://localhost:8911/path/to/servlet [P]
>
> I get exactly one CometEvent.EventType.READ event with all of the data 
> after I finish sending data from the client.
that is cause the proxy buffers the entire request. The Comet technique 
messes with the logistics of the HTTP protocol, so this behavior is not 
incorrect when proxying.

>
>
> When I have a Tomcat connector like this:
> <Connector port="8909" protocol="AJP/1.3"
>   address="127.0.0.1" />

AJP connectors dont support Comet, so this wont work.

>
> and have Apache httpd proxy requests like this:
>
> RewriteRule ^/path/to/servlet ajp://localhost:8909/path/to/servlet [P]
>
> I get zero CometEvents and the client gets an HTTP error 405 (Method 
> Not Allowed). I was hoping that AJP would work so I could try using 
> ProxyPass with flushpackets=on, but the Apache documentation says that 
> only works with AJP.
>
>
> If I use Http11NioConnector instead of HTTP/1.1 and try to proxy with 
> Apache, I get the same results as if I were using the HTTP/1.1 connector.
>
> My client code (Java) is:
>
> // Direct to Tomcat (HTTP)
> //URL url = new URL( "http://server:8912/path/to/servlet" );
> // Apache proxies to Tomcat
> URL url = new URL( "http://server/path/to/servlet" );
> HttpURLConnection connection = (HttpURLConnection)
>   url.openConnection();
> connection.setChunkedStreamingMode( 1 );
> connection.setDoOutput( true );
> connection.setDoInput( true );
> connection.connect();
> OutputStream os = connection.getOutputStream();
> for ( int i = 0; i < 10; i++ ) {
>   os.write( 1 );
>   os.flush();
>   Thread.sleep( 1000 );
> }
> os.close();
> log.debug( "response:" + connection.getResponseCode() );
> log.debug( "response:" + connection.getResponseMessage() );
> connection.disconnect();
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message