Skip to content

Instantly share code, notes, and snippets.

@jeremypage
Created October 16, 2017 10:42
Show Gist options
  • Save jeremypage/b2d9dd7c5db1fafa182b6d435ca1ec6c to your computer and use it in GitHub Desktop.
Save jeremypage/b2d9dd7c5db1fafa182b6d435ca1ec6c to your computer and use it in GitHub Desktop.
web.config: Force browsers to re-validate redirects (HTTP 301 and HTTP 302). Useful when a redirect has changed or been removed.
<configuration>
<system.webServer>
<rewrite>
<outboundRules>
<rule name="Require clients to re-validate redirects">
<match serverVariable="RESPONSE_Cache_Control" pattern=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{RESPONSE_STATUS}" pattern="301" />
<add input="{RESPONSE_STATUS}" pattern="302" />
</conditions>
<action type="Rewrite" value="public, must-revalidate, max-age=0" />
</rule>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment