My live blog site runs on ColdFusion (using JRun) with the SES servlet mappings in web.xml. I use the excellent MangoBlog engine for powering my blog. All this means that I have pretty-ish URLs like http://blog.nagpals.com/blog/post.cfm/ftp-in-eclipse-hooray.
Today I wanted to run a copy of my blog on a dev box. But on that dev box, I chose to use JBoss-Tomcat. And the SES servlet mappings that work in ColdFusion on JRun, do NOT work on ColdFusion on Tomcat-JBoss as they are not supported by the servlet engine.
To get around it, I simply used Apache-based rewrites so that the SES urls like http://blog.nagpals.com/blog/post.cfm/ftp-in-eclipse-hooray automatically get mapped to http://blog.nagpals.com/blog/post.cfm?entry=ftp-in-eclipse-hooray.
Here are the rewrites that I put in place to get posts, categories, pages and search to work.
<VirtualHost *:80 > ServerName nagpals.local RewriteEngine On RewriteOptions Inherit RewriteRule ^/blog/post.cfm/(.*) http://127.0.0.1:8680/blog/post.cfm?entry=$1 [P,L] RewriteRule ^/blog/page.cfm/(.*) http://127.0.0.1:8680/blog/page.cfm?entry=$1 [P,L] RewriteRule ^/blog/archives.cfm/search/(.*) http://127.0.0.1:8680/blog/archives.cfm$1 [P,L] RewriteRule ^/blog/archives.cfm/category/(.*) http://127.0.0.1:8680/blog/archives.cfm?category=$1 [P,L] RewriteRule ^/(.*) http://127.0.0.1:8680/$1 [P,L] ProxyPassReverse / http://127.0.0.1:8680/ ProxyPreserveHost on </VirtualHost>
This would be useful for another reason. If you use MangoBlog on Railo running on JBoss/Resin with Apache in front, you can employ the same trick to get around the whole issue of SES URLs.
Doesn’t mango do this out of the box, the same way BlogCFC does?
The mapping tool would be useful for removing the “page.cfm” completely, but not sure how this would be handled in Mango, as they have multiple front controllers (page.cfm,archives.cfm etc)
When I did the presentation to the CFUG last month I didn’t have to do any mapping stuff to get the /page.cfm/page-name to work…
On JRun you have enable the SES servlet to get urls like http://yourserver/post.cfm/blah_page
On Tomcat-JBoss, SES servlet does not work. Therefore you need to these Apache mappings to get it work.
OK.
I haven’t had to set up any SES stuff at all for Mango to work.
Maybe I’m missing something 🙂
Are you using straight CF install? Or EAR/WAR deployment?
Hey Indy,
I did some digging on my CF installs (JRUN) I have Mango deployed on did have SES enabled, but not to the level you set up.
EG: “*.cfm/*”, and not down to each type.
Must be on in the standard install in the web.xml now. It used to be off by default!
Would something like “^(.*)\.cfm\(.*)” work to?
(from http://www.mangoblog.org/forums/messages.cfm?threadid=31698CAA-3048-2A53-704D7139B9554D78#3)
Does this effect the cache and speed of calling pages ?
I would doubt it. Apache is pretty optimized.
Another workaround would be to simply add to Tomcat config a url-pattern of /blog/post.cfm/* in a servlet mapping, for CF. (reference http://corfield.org/entry/Railo_for_Dummies_Part_V)