tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Wilson <rwil...@kingsisle.com>
Subject RE: CometProcessor proxied through Apache httpd
Date Wed, 27 Jan 2010 15:49:34 GMT
Have you tried using mod_proxy_ajp?

ProxyPass /some/path ajp://tomcat.host.domain:8009/some/other/path



--
Robin D. Wilson
Director of Web Development
KingsIsle Entertainment, Inc.
CELL: 512-426-3929
DESK: 512-623-5913
www.KingsIsle.com

-----Original Message-----
From: Stephen Byrne [mailto:stephen@lincware.com] 
Sent: Wednesday, January 27, 2010 9:27 AM
To: users@tomcat.apache.org
Subject: CometProcessor proxied through Apache httpd

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.


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.


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

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