6

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>
Michael
  • 8,362
  • 6
  • 61
  • 88
David Freire
  • 671
  • 9
  • 23

1 Answers1

13

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>
Michael
  • 8,362
  • 6
  • 61
  • 88
David Freire
  • 671
  • 9
  • 23