Getting Coldfusion working with Helicon APE

ColdFusion Add comments

I recently tried to do some rewrite rules on my ColdFusion site using Helicon APE and could not get them to work for love nor money. It worked fine when rewriting to a non .cfm page, but when rewriting to a .cfm page The result was either a "server error" or a "404.3" error as per the below screenshot

image

The cause of this is due to the wildcard handler that ColdFusion uses, when you hit a url that gets intercepted by APE due to a rewrite rule which then attempts to rewrite to another CFM page this does not get processed by the wildcard handler, instead APE tries to process the request with a standard script map, the result of which will be different depending on how you have your server setup.

If you have a standard non modified CF install then in addition to the woldcard (*) handler you also have a bunch of regular script map handlers for each extension that ColdFusion handles (*,cfm, *.cfc, *.cfswf etc), these will be named "AboMapperCustom-xxxxxxxx".

Each of these script map handlers points to the file "jrun_iis6.dll" which actually doesn't work at all on IIS 6 or IIS 7 and thus these handlers seem to serve no purpose. Why these handlers are even created I cannot say, my best guess is that they are a leftover legacy setting from IIS 5.
the only handler that is able to process Coldfusion files is the wildcard handler which points to the following connector.

jrun_iis6_wildcard.dll

So in order for APE to be able to work with CFM files or any of the other CF related extensions then you need to update all those script map handlers to point to "jrun_iis6_wildcard.dll" instead of "jrun_iis6.dll".

If you are on a shared host and do not have access to the IIS manager, then you can fix this in your web.config file if you are running on IIS 7, if you are on IIS 6 then you will need to speak with your host as IIS 6 does not have a web.config.

Below is an example of the changes you need to make to your web.config.
If Coldfusion is enabled globally on the server then the <remove> statements disable the original handlers (you must use the original/actual names of the handlers), if Coldfusion is not enabled server wide then you don't need these.

The <add> statements creates a new set of handlers with the correct connector, these can be named anything you like as they are specific to your site. If Coldfusion is already enabled on your site (IIS 7 only) rather than globally then you will already have a bunch of entries like this in your web.config, in which case simply update the "ScriptProcesstor" path as below to point to "jrun_iis6_wildcard.dll" instead of "jrun_iis6.dll".






<?xml version="1.0" encoding="UTF-8"?>


<configuration>


<system.webServer>


<handlers>


<remove name="AboMapperCustom-xxxxxxxx" />


<remove name="AboMapperCustom-xxxxxxxx" />


<remove name="AboMapperCustom-xxxxxxxx" />


<remove name="AboMapperCustom-xxxxxxxx" />


<remove name="AboMapperCustom-xxxxxxxx" />


<add name="AboMapperCustom-xxxxxxxx" path="*.cfm" verb="*" modules="IsapiModule"


scriptProcessor="C:\ColdFusion9\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll"


resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />


<add name="AboMapperCustom-xxxxxxxx" path="*.cfc" verb="*" modules="IsapiModule"


scriptProcessor="C:\ColdFusion9\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll"


resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />


<add name="AboMapperCustom-xxxxxxxx" path="*.cfml" verb="*" modules="IsapiModule"


scriptProcessor="C:\ColdFusion9\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll"


resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />


<add name="AboMapperCustom-xxxxxxxx" path="*.cfr" verb="*" modules="IsapiModule"


scriptProcessor="C:\ColdFusion9\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll"


resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />


<add name="AboMapperCustom-xxxxxxxx" path="*.cfswf" verb="*" modules="IsapiModule"


scriptProcessor="C:\ColdFusion9\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll"


resourceType="Unspecified" requireAccess="Script" responseBufferLimit="0" />


</handlers>


</system.webServer>


</configuration>

 

9 responses to “Getting Coldfusion working with Helicon APE”

  1. Todd Sharp Says:
    Why not just use the built in rewriting in IIS?
  2. David Boyer Says:
    @Todd Maybe Russ is after something else that Helicon APE provides? I've been curious about its support for the X-SendFile header for handling downloads that I'd like ColdFusion to process but not have to deal with the overhead. :)
  3. Russ Michaels Says:
    APE does indeed do more than URL rewriting, it also does .htaccess password protection, which is what I am using it for.
    But in the case of URL rewriting, the point in APE is that it is compatible with APACCHE rules, so PHP apps written for Apache which will work on IIS without you having to convert all the rules to URL rewrite, it also emulates many other apache mods as well.
  4. Henry Ho Says:
    Unfortunately APE mod_xsendfile does NOT work with CF.
    "It's a known issue that after jrun_iis6_wildcard.dll the request processing in IIS stops, which means that Helicon Ape doesn't receive the events that are executed after the handler. Mod_xsendfile, in its turn, takes place after the handler."
  5. Russ Michaels Says:
    Henry, did you try using regular handler instead of wildcard handler? You have to use the same jrun_iis6wildcard.dll though, as jrun_iis6.dll doesn't actually work
  6. Henry Ho Says:
    @Russ, yes I tried removing the wildcard handler, and change .cfm handler to use jrun_iis6wildcard.dll and it doesn't work. Apparently it's jrun_iis6wildcard.dll's fault, according to Helicon Tech. So mod_xsendfile doesn't work.
    http://www.helicontech.com/community/mod_xsendfile_problems-8-1090.html
  7. Russ Michaels Says:
    Are you Definitely using iis7 native connector
  8. Henry Ho Says:
    @Russ, oh I'm not sure. How can I check? What's the difference? Doesn't APE work with IIS6 compatibility mode?
  9. Russ Michaels Says:
    I have seen iis6 connector cause odd issues with isapi filters.
    It is confusing because the filename for the iis7 connector is the same As the iis6 connector.
    You must remove all connectors from all sites using wsconfig, then remove iis6 compatibility mode, then use wsconfig to recreate connectors.

Leave a Reply

Leave this field empty

Powered by Mango Blog. Design and Icons by N.Design Studio