1 Reply Latest reply on Jun 27, 2014 6:27 AM by CutterBl

    HTTP status code returned by site-wide error handler is 200 OK?

    cherdt Level 1

      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?

        • 1. Re: HTTP status code returned by site-wide error handler is 200 OK?
          CutterBl Level 1

          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.

          1 person found this helpful