I finally found the solution (and, more importantly, an understanding of the issue) I was looking for to fully integration the default Apache instance on my development machine with Railo and Tomcat. I've previously written about setting up Railo and Tomcat on Aptana Cloud, however, for my local machine, I setup Railo with Resin to connect to Apache.

After giving it some thought, I decided that I needed to bite the bullet and mirror a production setup for my development environment (my production servers are using Tomcat, not Resin). Getting Tomcat, Railo and Apache to play together really wasn't that hard. There are tons of good blog posts on it (links below) from Sean Corfield, Matt Woodware and others. All very helpful.

A significant part of the integration process was to use AJP (Apache JServ Protocol) to proxy HTTP requests from Apache to Tomcat. The standard Apache/Tomcat integration results in Apache, essentially, turning over all HTTP requests to Tomcat.

The problem, for me, was that I wasn't getting how Apache could proxy requests to Tomcat. A combination of posts from Sean Corfield's and Matt Woodward's blogs had the explanations and code sample I needed.

I won't restate what's already been well-written but I encourage anyone looking to get Apache, Tomcat and Railo going on their dev (or production) boxes to check out those posts. An important bit to note is that AJP is part of (or installed with) Tomcat by default. It's freaking been there the whole time :)!

Following is a sample change on Matt's blog, I made the following change to my VirtualHost(s) so that I proxied my requests to Tomcat rather than letting Apache turn over the entire HTTP request.

Note: The SyntaxHighlighter utility alters my Apache code and some tag attributes will be incorrect (e.g., the opening VirtualHost element, which should read <VirtualHost *:80> will be altered)

<VirtualHost *:80>
ServerName dev.mysite.local
ServerAdmin somepin@gmail.com
DirectoryIndex index.cfm index.html index.htm
DocumentRoot /Users/myusername/Sites/mysite
# here comes the proxy details!!!
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
</VirtualHost>

In addition to the Proxy instructions, I removed the line of code that mounted mod_jk to my virtual host (JkMount /*.cfm coldfusion). The result of this has been that all three servers play nicely (Apache, Tomcat, and Railo) AND all my SES URLs work perfectly without UrlRewriteFilter in place. By proxying the requests, I think I can even use Apache Rewrite Rules in my VirtualHost element. I'll try that out this weekend. Yeah! I love it when servers play nicely together.

It's moments like these that I realize why my wife and friends make fun me all the time. I'm such a dork...but I love it :)!

Comments

Craig Kaminsky
@coldfusion: Thanks! Your STAR stack looks pretty interesting.
coldfusion
please also take a look at the STAR stack found http://aphatak.blogspot.com/2010/03/new-web-stack-star.html

I have been using it for a while now