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://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://nagpals.com/blog/post.cfm/ftp-in-eclipse-hooray automatically get mapped to http://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.

Comments

David

David wrote on 06/16/09 7:32 AM

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...
Indy Nagpal

Indy Nagpal wrote on 06/16/09 8:31 AM

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.
David

David wrote on 06/16/09 10:01 AM

OK.
I haven't had to set up any SES stuff at all for Mango to work.
Maybe I'm missing something :-)
Indy Nagpal

Indy Nagpal wrote on 06/16/09 10:22 AM

Are you using straight CF install? Or EAR/WAR deployment?
David

David wrote on 06/17/09 10:02 PM

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)
Kraloyun

Kraloyun wrote on 10/05/09 12:49 PM

Does this effect the cache and speed of calling pages ?
Indy Nagpal

Indy Nagpal wrote on 10/05/09 1:32 PM

I would doubt it. Apache is pretty optimized.
Jamie Krug

Jamie Krug wrote on 12/18/09 8:57 AM

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)
oyunlar

oyunlar wrote on 02/13/10 8:01 AM

exceptionale mattress is called the Perfect Night Mattress and, like other beautyrest mattresses, offers you a good night's sleep and support where you need it the most. You will feel comfortable and rested once you have slept on this mattress."

Leave a comment

Tell us about yourself
(required field)
(required field)
Comment and preferences
Leave this field empty: