Highlighted

ColdFusion fails to include custom HTTP response header set in IIS 8.5

Participant ,
Mar 23, 2016

Copy link to clipboard

Copied

(this is a cross-posting of a question I asked on Server Fault: ColdFusion fails to include custom HTTP response header set in IIS 8.5 - Server Fault)

I have a Windows 2012 R2 server running IIS 8.5 and ColdFusion 11. Under a specific directory ("mydirectory") I added an HTTP Response Header (Name: X-ResponseHeader, Value: Test). The resulting web.config section looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="X-ResponseHeader" value="Test" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>

I created several test files:

  • test.cfm
  • test.html
  • test.png

I used curl -I to request the files and examine the response headers:

  • test.cfm does not include the response header
  • test.html includes X-ResponseHeader: Test
  • test.png includes X-ResponseHeader: Test

Additionally, a request for a non-existent .cfm file does not include the header, but a request for a non-existent .png file does. Therefore I suspect that the ColdFusion handler is ignoring or removing the header, but I am not sure why.

Also of note: if I set a custom header at the site level in IIS, rather than at the folder level, the custom header is included in all cases.

Views

550

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

ColdFusion fails to include custom HTTP response header set in IIS 8.5

Participant ,
Mar 23, 2016

Copy link to clipboard

Copied

(this is a cross-posting of a question I asked on Server Fault: ColdFusion fails to include custom HTTP response header set in IIS 8.5 - Server Fault)

I have a Windows 2012 R2 server running IIS 8.5 and ColdFusion 11. Under a specific directory ("mydirectory") I added an HTTP Response Header (Name: X-ResponseHeader, Value: Test). The resulting web.config section looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="X-ResponseHeader" value="Test" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>

I created several test files:

  • test.cfm
  • test.html
  • test.png

I used curl -I to request the files and examine the response headers:

  • test.cfm does not include the response header
  • test.html includes X-ResponseHeader: Test
  • test.png includes X-ResponseHeader: Test

Additionally, a request for a non-existent .cfm file does not include the header, but a request for a non-existent .png file does. Therefore I suspect that the ColdFusion handler is ignoring or removing the header, but I am not sure why.

Also of note: if I set a custom header at the site level in IIS, rather than at the folder level, the custom header is included in all cases.

Views

551

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 23, 2016 0
Advocate ,
Mar 23, 2016

Copy link to clipboard

Copied

Which coldfusion 11 update are you running?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 23, 2016 0
Participant ,
Mar 23, 2016

Copy link to clipboard

Copied

ColdFusion 11 Update 7

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 23, 2016 0
Participant ,
Mar 23, 2016

Copy link to clipboard

Copied

I can no longer replicate this behavior. This was the bane of my existence 2 weeks ago and now it seems to be working...!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 23, 2016 0
haxtbh LATEST
Advocate ,
Mar 23, 2016

Copy link to clipboard

Copied

I am able to replicate it on CF11 with IIS7.5

I notice that the default document shows the header when called. If you defined the page (i.e. page.cfm) the header doesnt show.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 23, 2016 0