I came across this rule:
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
what is ON or OFF in pattern and what matches this pattern?
The pattern OFF is make sure that the rule executes only when the request comes in over http or else you might end up in an infinite loop.
So add a condition stating that {HTTPS} is OFF.
the ^ = (start of string, or "negative" if at the start of a range)
the $ = (end of string)
though the extra start/stop characters seem redundant for this purpose
Here is a blog that discusses inbound rules
input={HTTPS} could provide two input values, either OFF (for NO-HTTPS request) or ON(for an HTTPS request). Hence, to which if the pattern value matches, the rule gets executed. And that is why pattern="OFF" makes sure that the request comes in over http. Accordingly the rule gets executed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With