Skip to content

Instantly share code, notes, and snippets.

@greggnakamura
Created January 8, 2018 16:41
Show Gist options
  • Save greggnakamura/fd188549219953d2b1ae071e2b66102a to your computer and use it in GitHub Desktop.
Save greggnakamura/fd188549219953d2b1ae071e2b66102a to your computer and use it in GitHub Desktop.
web.config: Multiple `Access-Control-Allow-Origin` values
<!-- https://stackoverflow.com/questions/17323350/access-control-allow-origin-with-multiple-domains -->
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
<add name="Access-Control-Allow-Methods" value="POST,GET,OPTIONS,PUT,DELETE" />
</customHeaders>
</httpProtocol>
<rewrite>
<outboundRules>
<clear />
<rule name="AddCrossDomainHeader">
<match serverVariable="RESPONSE_Access_Control_Allow_Origin" pattern=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{HTTP_ORIGIN}" pattern="(http(s)?://((.+\.)?arbfile\.org|wwwqa01\.arbfile\.org|wwwdev01\.arbfile\.org))" />
</conditions>
<action type="Rewrite" value="{C:0}" />
</rule>
</outboundRules>
</rewrite>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment