David Freire
David Freire

Reputation: 671

IIS Rewrite exclude rule by HTTP method

Can I add a condition to exclude an IIS URL Rewrite rule if the request type is POST? I was not able to find it anywhere in the documentation.

I don't want to lower-case my URL if the HTTP method is POST.

 <rule name="LowerCaseRule" stopProcessing="true">
        <match url="[A-Z]" ignoreCase="false" />
        <action type="Redirect" url="{ToLower:{URL}}" />
 </rule>

Upvotes: 6

Views: 4725

Answers (1)

David Freire
David Freire

Reputation: 671

The solution is filtering the input {REQUEST_METHOD}, negating every request matching POST, like:

<conditions>
    <add input="{REQUEST_METHOD}" pattern="^POST$" ignoreCase="true" negate="true" />
</conditions>

Upvotes: 13

Related Questions