Anyone knows how to create a blocking request rule in IIS that do not meet the following requirements?
- custom header HTTP_MyMandatoryHeader must be present
- value of HTTP_MyMandatoryHeader must be a specific value
I tried with following IIS Url rewrite rule, but all requests are blocked with this.
<rewrite>
<rules>
<rule name="RequestBlockingRule1" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_MyMandatoryHeader}" pattern="^123$" negate="true" />
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
</rule>
</rules>
</rewrite>
Thanks, Tom