title: How to set custom headers with web.config?
body: <p>I have the following in the web.config, but after it's published to IIS 7.5 on the server, they couldn't be find under <code>IIS -&gt; HTTP Response Headers</code>.</p>
  
  <p>What I found is that the <code>web.config</code> on server doesn't have those entries either, but they were there before publishing. So I can only say the publishing process stripped them out, but there is nothing in the <code>web.config</code> transform files that removes them. So why are they gone from the published `web.config'?</p>
  
  <pre><code> &lt;system.webServer&gt;
      &lt;httpProtocol&gt;
        &lt;customHeaders&gt;
          &lt;add name="Access-Control-Allow-Origin" value="*" /&gt;
          &lt;add name="Access-Control-Allow-Headers" value="Content-Type" /&gt;
          &lt;add name="Access-Control-Allow-Methods" value="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" /&gt;
        &lt;/customHeaders&gt;
      &lt;/httpProtocol&gt;
  &lt;/system.webServer&gt;
  </code></pre>