Coldbox, Railo and Resin

Hi,

Does anyone have experience of Coldbox SES working with a Railo and Resin platform?

The standard SES rewrite .htaccess file doesn’t seem to be doing the job properly.

Thanks,

Si Forster

Hi again,

I’ve actually solved my problem, and also spotted a suspect rewrite rule in the coldbox install stuff.

I will not this here for anyone else having issues with that platform.

I needed to change the last line of the SES .htaccess.

http://coldbox.assembla.com/code/coldbox/subversion/nodes/coldbox/trunk/install/SES%20Rewrite%20Rules/.htaccess?rev=3156

I changed

RewriteRule ^(.*)$ index.cfm/%{REQUEST_URI} [QSA,L]

to

RewriteRule ^(.*)$ index.cfm%{REQUEST_URI}/ [QSA,L]

and the site works perfectly now.

Is there a reason for the slash after index.cfm? It seems to add a double slash (//) when the rewrite occurs? Also, the slash after probably isn’t needed.

I’m not great at rewrite rules so if anyone has any thoughts, feel free to chip in.

Thanks,

Si

Sana, is there way to confirm this, and to see what rules are good?

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Hi Si Forster,

The SES Rule works fine with Railo, Please make sure you don't have
any other thing which is causing "/" to be appended.
RewriteRule ^(.*)$ index.cfm/%{REQUEST_URI} [QSA,L]

Above Rule just append index.cfm + "/"

You can try like this http://localhost/help
Apache will translate this request to "index.cfm/help"

If you post your Apache settings that might help us in identifying the
issue.
Also check your config/Routes.cfm file, is there any thing which add
"/" in the request.

@Luis Rewrite Rule is fine, it could be something else for this issue.

Thanks
Sana

Hi,

Are you using Railo on Resin? Or Tomcat? Or something else?

RewriteRule ^(.*)$ index.cfm%{REQUEST_URI} [QSA,L]

it doesn’t work with:

RewriteRule ^(.*)$ index.cfm/%{REQUEST_URI} [QSA,L]

Rewrite log shows /forgebox going to index.cfm//forgebox, which fails on Resin.

Host is Alurium - http://alurium.com/ - they offer a free package if anyone wants to give it a shot at reproducing (though try not to spam their free trial).

Cheers,

Si

Below, find the .htaccess rules I am using in a Tomcat/Railo/ColdBox
site. I also, never was able to get the documented .htaccess rules to
work.

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.aarongreenlee\.com$ [NC]
RewriteRule ^(.*)$ http://aarongreenlee.com/$1 [R=301,L]

#Images, css, javascript and docs, add your own extensions if needed.
RewriteCond %{REQUEST_URI} \.(bmp|gif|jpe?g|png|css|js|txt|pdf|doc|xls|
xml)$
RewriteRule ^(.*)$ - [NC,L]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.cfm/$1 [L,QSA]

#Compress
SetOutputFilter DEFLATE
#AddOutputFilterByType DEFLATE text/plain text/xml text/css text/html
application/x-javascript application/javascript text/javascript

I also had problems with the default ColdBox rewrite rules on Railo /
Tomcat and had to modify them. So they may work fine for *you* but
they don't necessarily work for *every* setup.

FWIW, here's what I ended up using with Railo / Tomcat:

# handle static assets without rewrite:
RewriteRule ^.*\.(bmp|gif|htc|html?|jpe?g|ico|png|css|js|txt|pdf|doc|xls|xml)$
- [L]
# pass site root request thru directly:
RewriteRule ^/?$ ajp://localhost:8009/ [P,L]
# pass test and build requests thru directly:
RewriteRule ^/(build|core|mxunit|NAS|test|tests|railo-context)/(.*)$
ajp://localhost:8009/$1/$2 [P,L]
# pass all .cfm / .cfc requests thru:
RewriteRule ^/(.*\.cf[cm].*)$ ajp://localhost:8009/$1 [P,L]
# pass all others thru as assumed routes:
RewriteRule ^/(.*)$ ajp://localhost:8009/index.cfm/$1 [P,L]

(above that I have the Proxy directives etc)

Can you guys give my minor tweak (removal of slash) a crack and see how that works out? Also, those who it works for try removing it and check your rewrite logs.

Do some servers support // and others throw a wobbler maybe?

Si Forster
+44 7530 278845