Robin Wilson wrote:
Where are you putting the ProxyPass (which file, where in the file)?

Also, did you have this in the file somewhere before the ProxyPass:

        LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

AND... In your Apache "modules" directory, is there a 'mod_proxy_ajp.so' file?

Lastly, this is what our connector looks like in the 'server.xml' file for the 
tomcat instance:

            <Connector port="8009" protocol="AJP/1.3"
               />

So I'm not sure if the 'address' is causing the problem or not.

Keep in mind, 'proxy' (and AJP) don't work the same as HTTP exactly. The 
rewrites will just re-point your browser to use the new URL (so rewriting to an 
'ajp://' protocol will break the browser - since it doesn't speak 'ajp' 
protocol). The proxy actually passes the request _through_ the Apache HTTP 
process - to the Tomcat's AJP process - so the browser only talks 'http' to the 
Apache service, while Apache talks 'ajp' to the Tomcat service. It's the 
difference of:

Browser --HTTP request--> Apache
Browser <--HTTP (redirect to Tomcat path)-- Apache
Browser --HTTP request--> Tomcat
Browser <--HTTP response-- Tomcat

vs.

Browser --HTTP request--> Apache --AJP (proxied request)--> Tomcat
Browser <--HTTP response-- Apache <--AJP (proxied response)-- Tomcat

(I'll admit, I could be wrong on this - but that's how I think it works...)

I do have proxy_ajp_module loaded.
I have the ProxyPass (or RewriteRule) in a <VirtualHost>
The [P] at the end of the RewriteRule causes Apache to pass the request through the proxy - not to send a redirect to the browser.

Have you successfully used a CometProcessor behind an AJP proxy?

-Stephen


--
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:step...@lincware.com] Sent: Wednesday, January 27, 2010 9:54 AM
To: Tomcat Users List
Subject: Re: CometProcessor proxied through Apache httpd

Robin Wilson wrote:
Have you tried using mod_proxy_ajp?

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

Yes, I did try this, and got the same results as using RewriteRule - a 405 error.

--
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:step...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


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



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


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



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

Reply via email to