Although this post is now a few years old, I thought I would share my solution that may save someone hours of head-scratching.
I have an MVC 4 site setup using IIS, and my aim was to have IIS add headers to certain files (defined by location), by using the <customHeaders>
section. The 'cache-control' values I had in the <customHeaders>
section were being appended to the end of 'cache-control: private', magically being added by IIS.
This was because of the runAllManagedModulesForAllRequests setting in my web.config being set to true
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
</system.webServer>
This setting was causing one of the IIS Modules (I don't know which) to append the 'cache-control' header to every file being requested from IIS.
So the solution is to set this to false, and manage each of your modules seperatley using the preCondition
attribute on each.
The runAllManagedModulesForAllRequests setting was required by earlier versions of MVC because extensionless routing would not work without it. This has since been fixed, more details here
http://blogs.msdn.com/b/tmarq/archive/2010/04/01/asp-net-4-0-enables-routing-of-extensionless-urls-without-impacting-static-requests.aspx
Useful reading on the use of runAllManagedModulesForAllRequests
http://weblog.west-wind.com/posts/2012/Oct/25/Caveats-with-the-runAllManagedModulesForAllRequests-in-IIS-78