Copy link to clipboard
Copied
My goal seems simple.
I want IIS 7.5 to handle **ALL** 404 File Not Found requests, whether to static or dynamic (ColdFusion 9) content, and direct users to its custom 404 HTML page.
I believe that the IIS settings I need are existingReponse=Replace, errorMode=Custom, and a file path specified for the 404. That's what I've done.
With a CF10 install, it works. With CF9, **for some reason both the static IIS 404 response AND the ColdFusion 404 response are sent to the client and displayed**. Very weird.
I've tried all manner of alternate configurations, and there seems to be some problem with each approach.
Any ideas why IIS would fail to replace Coldfusion's 404 message? Is ColdFusion failing to communicate to IIS (via the appropriate header) that it's sending a 404? Is IIS being obstinate? Why would it be different with CF10 and CF9?
--------------------------
ColdFusion 9, via CFAdmin
--------------------------
Global Settings
- Missing Template Handler = [no path specified]
--------------------------
IIS 7, via IIS Manager
--------------------------
Configuration Editor -> system.webServer/httpErrors
- allowAbsolutePathWhenDelegated = false
- defualtPath = [no path specified]
- defaultResponseMode = File
- errorMode = Custom
- existingResponse = Replace
Configuration Editor -> system.webServer/httpErrors -> Edit Collection
- 404 Error
path = [DriveLetter]:\inetpub\wwwroot\CAES\global\errorHandling\404.html
prefixLanguageFilePath = [none specified]
respnseMode = File
statusCode = 404
subStatusCode = -1
- 403 Error
path = [DriveLetter]:\inetpub\wwwroot\CAES\global\errorHandling\403.html
prefixLanguageFilePath = [none specified]
respnseMode = File
statusCode = 404
subStatusCode = -1
Copy link to clipboard
Copied
I have not tried all this with CF9 on IIS7, only with CF10 on IIS7. I know you said CF10 is working fine (so you have two different boxes? and why not just use CF10?), but you may want to try setting just <httpErrors existingResponse="PassThrough" /> in your web.config, and use the CFAdmin's master "Missing Template Handler" to specify your custom 404 file. In my experience, getting it all to work perfectly using IIS only is impossible. Another tip: install IIS URL Rewrite module and create a rule for handling missing files and directories. It would look something like this:
<rule name="If no file or directory" stopProcessing="true">
<match url="." />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="/error404.cfm" />
</rule>
I had to use a combination of these things to get 404 and 500 handling to work with CF exactly like it did with IIS6. I use custom CF pages for both error types. There is a lot of discussion on this issue around here. This is probably the biggest thread on the subject: http://forums.adobe.com/message/5388861
There was an actual bug in CF10 regarding 404 handling, but that was fixed recently.
Copy link to clipboard
Copied
Thanks, David.
Our production environment is mostly CF9 right now, and it'll be a few months before we move completely to CF10. I was hoping to get CF 9 squared away in the meantime, but I don't want to invest lots of time since it'll be replaced fairly soon.
Once we do migrate, I'm hoping I can transition all our error pages to the "Very Dumb" but "Very Simple" non-dynamic versions. In my experience, the added complexity of custom 404 pages hasn't been of great value to our users, and results in a good bit more overhead for us.
I do find it odd that there has been so much trouble with dynamic configurations in all versions of IIS and CF. Every release of CF brings expectations that things will run more smoothly, and it doesn't seem to happen.
In any case, I appreciate your response. It's helpful information if we choose to go that route.