As I recreated a production environment on my local development platform, a requirement was to assign a custom 404 Error Page. The web server is IIS (Internet Information Services) 7 on production and development.
In IIS Manager, I’d click the website name, double-click the “Error Pages” icon and then double-click the 404 Status Code row. I would change the “Execute a URL on this site” value for the URL to the 404 ColdFusion page I needed. This exactly replicates what I saw on production.
However, when I would go to the URL I had binded to the site (http://mysite.local), the default IIS error page would show. I checked, rechecked and re-verified the settings to no avail. Then I noticed this “Edit Feature Settings…” link under the Actions menu on the right of the Error Pages page. This is where I found my solution.
Apparently you can get different error displays if you are locally browsing the site as opposed to normal (remote) traffic. Here’s the fix:
- Open Internet Information Services (IIS) Manager
- Click your website name
- Double-click the “Error Pages” icon
- Click the “Edit Feature Settings…” link under Actions on the right column
- Change the “Error Responses” value to “Custom error pages” (the default is Detailed errors for local requests and custom error pages for remote requests)
The above setting will always display your intended custom error page even if you are browsing locally.