Search code examples
coldfusioncoldfusion-10coldfusion-11

Coldfusion same file different output on CF10 and CF11 using cfheader


I have this simple code in Coldfusion

<cfheader
statuscode="400"
statustext="There was something wrong with the request."
/>

<cfoutput>This is what I want to return as the output.</cfoutput>

<cfabort>

When I run this on my localhost running CF10, I get this output on my Chrome browser: enter image description here

But when I run this same file on another server running CF11, I get this output: enter image description here

Am I missing something? Is there some other way of doing this in CF11? Any help would be really appreciated. Thanks.


Solution

  • The issue actually has nothing to do with ColdFusion, either 10 or 11.
    By default, IIS shows not does not show the statustext portion of the error message; it only shows the statuscode number. This is a security feature to prevent data leakage. If you do want to show the statustext portion of the error message, that is called "Detailed Error Messages" in IIS.

    Steps to enable Detailed Error Messages in IIS 7:

    1. Open the IIS7 manager
    2. Select the Website and on its features view, double click on "Error Pages".
    3. Right click and select the "Edit Feature Settings…" or select the same from the Actions pane (in the right hand side)
    4. Select the "Detailed errors" radio button and click on OK
    5. Now, even your client browsers will be able to see the detailed error messages.

    More information: