I have searched for an answer but I have not been able to find a definitive source of information. What I am after is the ability to log/notify for EVERY 404 error. The information that I have found online solves some 404 errors but not all. I have done some testing and below are the results of that testing. How are you handling 404 errors with your Mura sites?
I am using IIS and Adobe ColdFusion and Mura 6.2.6338.
I created my own onSite404 function to capture that event from Mura.
I created my own ColdFusion page to capture when IIS fires it’s 404 handler.
Based on my testing it appears that there is some built-in Mura functionality to handle 404’s from the web root. They do not seem to follow the standard 404 execution pattern. Not sure I have seen that documented anywhere?
I received a couple of timeout errors during some of my testing. Not sure why. Probably in the way I am trying to call the normal Mura processing from my custom IIS 404 page.
Basically what I want is to have all IIS 404 errors call my own custom ColdFusion page where I can log/notify the error and then display the normal Mura 404 page (without using a redirect as that negates the 404 status code to the user).
Here are the results of my testing:
With only the Mura 404 page defined:
Requested URL onSite404 IIS 404 Displayed
called called
/filedoesnotexist.cfm No n/a shows home page
/filedoesnotexist.htm No n/a shows home page
/filedoesnotexist.asp No n/a shows iis 404 error
/folderdoesnotexist/ Yes n/a shows iis 404 error AND mura 404 page
/folderdoesnotexist/filedoesnotexist.cfm Yes n/a shows iis 404 error AND mura 404 page
/folderdoesnotexist/filedoesnotexist.htm Yes n/a shows iis 404 error AND mura 404 page
/folderdoesnotexist/filedoesnotexist.asp No n/a shows iis 404 error
With the Mura 404 page defined and the IIS 404 pointing to the same Mura 404 page /index.cfm/404/
:
Requested URL onSite404 IIS 404 Displayed
called called
/filedoesnotexist.cfm No Unknown shows home page
/filedoesnotexist.htm No Unknown shows home page
/filedoesnotexist.asp No Unknown shows mura 404 page
/folderdoesnotexist/ Yes Unknown shows mura 404 page
/folderdoesnotexist/filedoesnotexist.cfm Yes Unknown shows mura 404 page
/folderdoesnotexist/filedoesnotexist.htm Yes Unknown shows mura 404 page
/folderdoesnotexist/filedoesnotexist.asp No Unknown shows mura 404 page
With the Mura 404 page defined and the IIS 404 pointing to it’s own 404 page /iis404.cfm
:
Requested URL onSite404 IIS 404 Displayed
called called
/filedoesnotexist.cfm No No shows home page
/filedoesnotexist.htm No No shows home page
/filedoesnotexist.asp No Yes shows custom iis 404 page
/folderdoesnotexist/ Yes Yes shows custom iis 404 page
/folderdoesnotexist/filedoesnotexist.cfm Yes Yes shows custom iis 404 page
/folderdoesnotexist/filedoesnotexist.htm Yes Yes shows custom iis 404 page
/folderdoesnotexist/filedoesnotexist.asp No Yes shows custom iis 404 page
With the Mura 404 page defined and IIS 404 pointing to it’s own 404 page /iis404.cfm
in the web root that calls Mura processing via application.contentServer.handleRootRequest()
:
Requested URL onSite404 IIS 404 Displayed
called called
/filedoesnotexist.cfm No No shows home page
/filedoesnotexist.htm No No 500 Internal server error – coldfusion.runtime.RequestTimedOutException on query
/filedoesnotexist.asp No Yes shows home page
/folderdoesnotexist/ Yes Yes shows home page
/folderdoesnotexist/filedoesnotexist.cfm Yes Yes shows home page
/folderdoesnotexist/filedoesnotexist.htm Yes Yes shows CF sitewide error page - coldfusion.runtime.RequestTimedOutException on query
/folderdoesnotexist/filedoesnotexist.asp No Yes shows home page
With the Mura 404 page defined and IIS 404 pointing to it’s own 404 page /siteid/iis404.cfm
in the site id root that calls Mura processing via application.contentServer.parseURLLocal()
:
Requested URL onSite404 IIS 404 Displayed
called called
/filedoesnotexist.cfm No No shows home page
/filedoesnotexist.htm No No 500 Internal server error – coldfusion.runtime.RequestTimedOutException on query
/filedoesnotexist.asp No Yes shows home page
/folderdoesnotexist/ Yes Yes shows home page
/folderdoesnotexist/filedoesnotexist.cfm Yes Yes shows home page
/folderdoesnotexist/filedoesnotexist.htm Yes Yes shows CF sitewide error page - coldfusion.runtime.RequestTimedOutException on query
/folderdoesnotexist/filedoesnotexist.asp No Yes shows home page
Mura seems to be handling any ColdFusion 404 errors except in the web root and I can do my processing within the onSite404 method. But I can't figure out how to get other 404 errors to do my processing AND call the Mura 404 page to display to the user.
Just documenting some more findings. I have found mention on a couple of blog posts online that for IIS you should set existingResponse
to PassThrough
under the httpErrors
section of the configuration and it will fix some 404 issues. Well here are my test results after making that change:
With the Mura 404 page defined and the IIS 404 pointing to its own 404 page /iis404.cfm
and IIS httpErrors
set to PassThrough
for existingResponse
:
Requested URL onSite404 IIS 404 Displayed
called called
/filedoesnotexist.cfm No No shows home page
/filedoesnotexist.htm No No shows CF sitewide error page - coldfusion.runtime.RequestTimedOutException on query
/filedoesnotexist.asp No No shows blank 404 page
/folderdoesnotexist/ Yes No shows mura 404 page
/folderdoesnotexist/filedoesnotexist.cfm Yes No shows mura 404 page
/folderdoesnotexist/filedoesnotexist.htm Yes No shows mura 404 page
/folderdoesnotexist/filedoesnotexist.asp No No shows blank 404 page
So with this configuration it appears that the IIS 404 never actually calls my ColdFusion template. And worse on some requests it just sends a blank 404 response. Working as designed I suppose as the PassThrough tells it to just pass the response along.
Documenting another result after the answer from @Grant. I had already experimented with Mura's standard404Handler
method but did not want to override all of it's functionality because honestly, I'm not sure what all it is doing and did not want to break some standard Mura functionality. Also, I saw that it is from within this method that the onSite404
method is called. So I would assume that the test results from overrriding the standard404Handler
method would be no different than when using the 'onSite404` method. My test results support that.
With the Mura 404 page defined and the IIS 404 pointing to it’s own 404 page /iis404.cfm and overriding the Mura standard404Handler
:
Requested URL onSite404 IIS 404 standard404Handler Displayed
called called called
/filedoesnotexist.cfm No No No shows home page
/filedoesnotexist.htm No No No shows home page
/filedoesnotexist.asp No Yes No shows custom iis 404 page
/folderdoesnotexist/ No No Yes shows mura 404 page
/folderdoesnotexist/filedoesnotexist.cfm No No Yes shows mura 404 page
/folderdoesnotexist/filedoesnotexist.htm No No Yes shows mura 404 page
/folderdoesnotexist/filedoesnotexist.asp No Yes No shows custom iis 404 page
It is obvious now that I need to use both the Mura onSite404
method and some sort of custom 404 handler from my IIS configuration. So if I can just find a way to display the Mura 404 page, while keeping the 404 status code, after my custom 404 handler runs that will resolve my issue.