Copy link to clipboard
Copied
I'm using a developer install of ColdFusion 11. I set up the following page at http://localhost:8500/test/index.cfm:
<cfthrow type="application" message="This is an error">
When I visit that page, the HTTP status code returned is 500, as expected.
I then created the following page at http://localhost:8500/error.cfm:
<p>Sorry! That was an error.</p>
If I set the site-wide error handler in the CF Admin to /error.cfm and visit /test/index.cfm, the HTTP status code returned is 200 OK.
This seems weird to me. It looks like I can include the following in the error.cfm file to send an error code instead:
<cfheader statuscode="500" statustext="Server Error">
Does anyone see that as problematic? Is there a reason why the site-wide error handler should return 200 OK?
Copy link to clipboard
Copied
Error Codes are the responsibility of the developer, to define and broadcast. Ultimately, the ColdFusion server has acted appropriately and fulfilled the request (hence the 202). Only the code would know what error was truly thrown, and how to appropriately handle that message to the user, hence the need for you to change the header in the response, if you want that broadcast to the browser in anything of than a "successful request" type of status.