SES URLs in MangoBlog on Tomcat

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.

8 thoughts on “SES URLs in MangoBlog on Tomcat”

  1. 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…

  2. OK.
    I haven’t had to set up any SES stuff at all for Mango to work.
    Maybe I’m missing something 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *