.htaccessiis-7.5coldfusion-10cfwheelshelicon-ape

Workaround issue of Helicon Ape .htaccess RewriteRule from modifying Content Type


Issue:

Using .htaccess in IIS7.5 using Helicon Ape with the last RewriteRule which when left uncommented drops the Content-Type from the Response Headers as viewed by Chrome inspector (see example screen captures below). This occurs to the /flex2gateway/ path which should produce a Content-Type of application/x-amf:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^.*/index.cfm/(.*)$ [NC]
RewriteRule ^.*/index.cfm/(.*)$ ./rewrite.cfm/$1 [NS,L]
RewriteCond %{REQUEST_URI} !^.*/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|lucee|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$) [NC]
RewriteRule ^(.*)$ ./rewrite.cfm/$1 [NS,L]

Results from the last RewriteRule:

Results from the last RewriteRule

Results as they should be or when the last RewriteRule is commented out

Results as they should be or when the last RewriteRule is commented out

I have tried numerous workarounds including adding the following but nothing has resolved the issue:

RewriteRule ^flex2gateway/$ [NS,T=application/x-amp,L]

Solution

  • I finally figured it out and of course it was a simple fix!

    Just add jakarta| to the RewriteCond pattern:

    RewriteCond %{REQUEST_URI} !^.*/(jakarta|flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|lucee|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$) [NC]
    

    ColdFusion 10 is now using /jakarta/isapi_redirect.dll to process the flex2gateway path.