1

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.

1
  • I tested using ColdFusion 10, Windows Server 2008 R2 and IIS 7.5. The custom header is included for existing CFM templates "if called as the default document", but not if ".cfm" is in the URL path or if CFM file doesn't exist. Other file types receive the customer header whether they exist or not. If you use <CFHEADER NAME="X-ResponseHeader" VALUE="Test">, you run the risk of duplicating the headers if the rule exists in web.config. Mar 11, 2016 at 23:03

0

You must log in to answer this question.

Browse other questions tagged .