May 03, 2007

Flash Forms and mod_rewrite

Posted by: Jon Clausen

I use Apache's mod_rewrite quite often for other projects I work on besides Blogfusion. I recently upgraded a client site to use SES urls for all of their dynamic pages, but ran into a bit of a bug when it came to some of the Flash Forms in their administrative area of the site, specifically the <cfgrid> tag.

In mod_rewrite, you can use a Rewrite Condition in your .htaccess file or <VirtualHost> block like the following to stop any further processing of rewrite rules if the URI matches any of the parameters. I usually place a block at the top of my .htaccess file that looks something like this:

#Escape the following in the URI using pipe delimiter for strings
RewriteCond %{REQUEST_URI} ^jrunscripts|CFIDE|admin.+$
RewriteRule .* - [L]

I added the CFIDE and admin directory, which according to the source output off the the Flash object and javascript being written by CF, should have handled all of the missing directories. Unfortunately, the problem continued. After several hours of searching and digging through technotes, I finally found this unrelated technote about a problem with IIS, which contained following to provide a clue:

"Create a directory named 'CFFormGateway' under the IIS webroot. You may leave this newly created directory empty."

By jove, I think I've got it! So I changed the Rewrite Condition to:

#Escape the following in the URI using pipe delimiter for strings
RewriteCond %{REQUEST_URI} ^jrunscripts|CFIDE|CFFormGateway|admin.+$
RewriteRule .* - [L]

Bingo! CFGRID is back online...

For the most part, placing the above (minus the "admin" string, unless it applies) should allow mod_rewrite and Coldfusion Flash Forms to work and play nice together.

 
Continuing the discussion ...
Comments
Options FollowSymLinks
RewriteEngine on

#Escape the following in the URI using pipe delimiter for strings
RewriteCond %{REQUEST_URI} ^CFIDE|admin.+$
RewriteRule .* - [L]

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

I have this setup at the moment flash form does not work, please would you have a look whats wrong with this. I am using apache2.2

Thanks

Sana's Gravatar Posted by: Sana - Nov 21, 2007 5:41 AM

Sana,

The directory "jrunscripts" needs to be accessible and needs to be escaped from rewriting.

Just substitutue your:

RewriteCond %{REQUEST_URI} ^CFIDE|admin.+$

For:

RewriteCond %{REQUEST_URI} ^jrunscripts|CFIDE|admin.+$


Jon Clausen's Gravatar Posted by: Jon Clausen - Nov 21, 2007 10:33 AM

Post a Comment
Name

Email ( optional )

Your URL (optional)

Remember my information ?
Yes No
Subscribe to this comment thread ?
Yes No

Input the letter/number code in the image to verify you're a human and not a spammer.

Subscribe to this thread without commenting

Search

About The Author

Who 

Recent Comments

  • Jon Clausen: <  @Jeff - It's been a couple of years now since...
    [View]
  • Rob: <  What problems do you have with the free FileM...
    [View]
  • Jeff Coughlin: <  For years I've used csdiff on the PC (absolut...
    [View]
  • Jon Clausen: <  @Priyank - Are you speaking of a problem brow...
    [View]
  • Priyank jain : <  Hi everybody,my application was running fine ...
    [View]
  • Jon Clausen: <  Hi Mike,I actually did when I wrote this post...
    [View]
  • Mike: <  Add it to the flicker account :-) http://www...
    [View]
  • Jon Clausen: <  Sana,The directory "jrunscripts" needs to be ...
    [View]
  • Sana: <  Options FollowSymLinksRewriteEngine on#Escape...
    [View]
  • Anthony: <  Just want to say thank you. I had this issue...
    [View]