ColdFusion 10 + IIS: Non-existant URLs that are CFM files. Retrieving original URL after executing 404 page

后端 未结 3 472
北荒
北荒 2020-12-16 08:09

We have a server setup as follows:

  • Windows 2012 R2
  • Coldfusion 10, Enterprise
  • IIS, configure with custom 404 page (execute on server)
3条回答
  •  伪装坚强ぢ
    2020-12-16 09:04

    NOTE: Question above includes a solution as well.

    I think this is an error with the Coldfusion Connector. I would post a bug report to Adobe (https://bugbase.adobe.com/). I do have a workaround though. I have the same issue, but I use IIRF (Ionic IIS Redirector - http://iirf.codeplex.com/), and I found a way to use that to avoid the bug for now:

    1. Remove any previous 404 file configuration in IIS/Coldfusion
    2. Install IIRF normally, according to it's install instructions.
    3. In the IirfGlobal.ini file (normally located in C:\Windows\System32\inetsrv\IIRF), add the following line:

      RewriteFilterPriority HIGH
      

      This will allow IIRF to handle 404 requests before it even hits ColdFusion/Tomcat.

    4. In the site-specific Iirf.ini (usually you create one in the root folder of your web files -- see the IIRF docs for details), add the following rules:

      RewriteCond %{SCRIPT_TRANSLATED} !-f
      RewriteCond %{SCRIPT_TRANSLATED} !-d
      RewriteRule ^(.+)$ page_to_redirect_to.cfm?404;$1 [L]
      

      That will redirect all files/directories that don't exist to page_to_redirect_to.cfm, and add the 404 query string like normal.

    5. EDIT: Added a following step: Go into the IIS Manager and select either the server or the Web Site that was configured to use IIRF, then go into the ISAPI Filters section. Click on "View Ordered List", then move the IIRF filter up to the top.

    EDIT 2: Just posted a bug to Adobe. See https://bugbase.adobe.com/index.cfm?event=bug&id=3630245

    Hope that helps.

提交回复
热议问题