httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Shuck <dsh...@gmail.com>
Subject Re: [users@httpd] httpd 2.2.4 + mod_proxy + tomcat 6.0.9 + ColdFusion
Date Mon, 12 Feb 2007 14:54:02 GMT
I hate to spam up the list with this issue, but I have another question if you 
would indulge me.  To strip this down a bit, let's just forget about the 
multiple instances and say I have a single instance of Tomcat and have 
installed ColdFusion as an application within it.   

So far I have been able to forward .cfm files to ColdFusion via mod_jk and 
ProxyPass, but neither was in the way that I expected.  I haven't been able 
to successfully process cfm files with the RewriteRule method.  Perhaps the 
problem is in my expectation rather than functionality.

Here is what I would expect to happen.  In Tomcat there is a webapp 
named "ROOT" which is where the ColdFusion web admin tools and such 
installed.  It's physical path is /usr/local/apache-tomcat/webapps/ROOT I can 
hit that with http://localhost:8080/......   Then in my httpd-vhosts.conf I 
have a website that is pathed /usr/local/apache2/htdocs/whateversite.  I 
Ideally I want all my files to exist in the .../htdocs/whateversite directory 
and when I hit a .cfm file in that directory, I want that file to be 
processed by the ColdFusion application.    

When I used ProxyPass, any request to 'whateversite' would just forward the 
request to the 'ROOT' site and expect the requested file to exist 
in .../webapps/ROOT.    Obviously this wasn't the answer.

When I used mod_jk, any non-".cfm" templates would serve properly but when it 
went to serve the ".cfm" templates it would expect those to exist in 
that "ROOT" directory rather in the "whateversite" directory just as 
ProxyPass had.  This was closer but still not the answer.

I haven't yet gotten your suggestion working using RewriteRule, but  would 
this work as I was expecting where it would not actually re-route the request 
to look for the template in another directory, but actually process the 
requested template through the application?

For what it's worth, I added this to the bottom of my httpd.conf file:
ReWriteEngine on
RewriteRule  ^\/(.+)\.cfm(.+)? ajp://localhost:8009/$1.cfm$2 [P,L]
RewriteRule  ^\/(.+)\.cfc(.+)? ajp://localhost:8009/$1.cfc$2 [P,L]

And this does exist in my Tomcat server.xml:
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

When I put request a ColdFusion template it just serves the plain text back 
from the template sitting in the "whatever" site.  I am not seeing any 
errors, but it just seems to do nothing with that ".cfm" request.

Again, I feel like I am just missing something that is probably painfully 
obvious to others, but after reading and re-reading through the docs I am 
just not finding the exact answer I am looking for.

Thanks again for your advice, and if you have any further advice I would 
greatly appreciate it.

~Dave

On Monday 12 February 2007 04:29:33 Pid wrote:
> Dave Shuck wrote:
> > Pid, I appreciate your response.  I would like to understand this a
> > little better as it is currently just slightly more clear than voodoo
> > magic to me. Is the specification of the port what points it to a
> > specific instance on Tomcat?  If so, I am assuming that I have to create
> > some type of matching piece on the Tomcat side.  Is this correct?
> >
> > Thanks again!
> >
> > On Sunday 11 February 2007 12:18:48 Pid wrote:
> >> ReWriteEngine on
> >>
> >> RewriteRule  ^\/(.+)\.cfm(.+)? ajp://localhost:8009/$1.cfm$2 [P,L]
> >> RewriteRule  ^\/(.+)\.cfc(.+)? ajp://localhost:8009/$1.cfc$2 [P,L]
>
> Hi
>
> (Yes, sorry - dashed a quick reply off as I was heading out.)
>
>
> mod_rewrite lets you send to a configured proxy.
>
> The rule is designed to capture URLs by file type; the bit before .cfm
> gets the main bit of the path, the bit afterwards captures query string
> and session id data.
>
> ajp:// indicates the protocol (you could also use http:// with the
> mod_proxy_http, but ajp is binary and superior in most cases)
>
> (If you have a cluster - more than one tomcat - let me know)
>
> localhost:8009 - server and port follow, which is a configured tomcat
> instance, to which you pass the path back references.
>
> [P,L] are the mod_rewrite 'proxy' and 'last' rule instructions,
> respectively.
>
> You can find detailed information about mod_rewrite in the Apache docs.
>   It is worth trying to get your head around the mod_proxy doc.  The
> mod_proxy_ajp documentation is somewhat obscure, as it isn't
> particularly clear that you don't need to do anything to configure it.
>
> The main mod_proxy module accepts all the configuration instructions,
> the sub modules only provide protocol connectivity.
>
> (ie you need mod_proxy_HTTP to: RRule /path HTTP://server:port/path )
>
>
> The other way to forward requests is, as you mentioned, ProxyPass.
> This is useful if you wish to send most requests to a server, but you
> *can* specify which paths not to.
>
> E.g.
>
> ProxyPass /css 		!  # a wayne's world style suffix 'not'
> ProxyPass /javascript 	!  # one per path definition
>
> ProxyPass /		ajp://server/port/ option=value option=value
>
>
>
> On to Tomcat: only the ajp connector needs to be active; you can disable
> the http one if you're not going to use it.  you only need to look at
> the ajp connector port number, it should work out of the box.
>
> if you need help with tomcat configuration, join the tomcat-users list
> and ask (me?) for help there.
>
>
> p
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org



-- 
~Dave Shuck
dshuck@gmail.com
www.daveshuck.com

Where's your Spot? 
www.instantspot.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message