Wednesday, April 16, 2014

IIS 7, Railo and Rewrite Rules (SES)

I recently added the "suggested" SES rewrite rules for my Coldbox app.  I use IIS7 along with Railo Tomcat.  After the rewrite rules were added to my web.config file and uploaded, my Railo admin became (keywords coming:) ugly, unusuable, missing CSS, no style, missing images...just horrible!

You're a developer.  You've been searching for a while.  (Because you didn't find this post sooner.)  You are struggling with getting the Railo Admininistrator screen to look like it ought to.  Everyone says "Oh...sorry, we don't use IIS."  Or those that do say "Oh...sorry, we use Helicon Rewrite engine."  Or even better: "Windows?  Sorry, man..."

I stumbled on a post finally after getting some community attempts at helping, but no real answer.  I don't have the link to the post handy, but at the end of the discussion, the fella said "Okay, well, I'll go back to using Path_Info."   For me, this was for Coldbox and Railo on IIS.  Perhaps you're using CFWheels or another framework where the SES requires rewrite rules.

The rule I had found initially used SCRIPT_NAME.  Not sure if that's an IIS vs. Railo vs. Tomcat problem, but I gave it shot.  It worked!  No more ugly Railo admin screens.  I could actually see what I was doing in there!  (When it doesn't work, and tries to rewrite the Railo links, you might be butchering your error logs for your app, as well as confusing your IIS log files, I'm sure.)

Here's my current rule from my web.config.  (Or you can adapt it for the visual interface in the IIS admin, if you need to.)

<rule name="Application Administration" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{PATH_INFO}" pattern="^/(.*(CFIDE|cfide|CFFormGateway|jrunscripts|railo-context|fckeditor|ckeditor)).*$" ignoreCase="true" />
</conditions>
<action type="None" />
 </rule>

Rules you may have found previously may use SCRIPT_NAME.  Try swapping it out.  Hope you found this and it solved your problem in 5 minutes instead of the week I've been needing an answer.

- Will Belden
April 16, 2014

1 comment:

Maria said...

Thiis is great