Last active
October 31, 2022 20:08
-
-
Save nikanos/a32ebc57edd6df877f3aa58f7eb94e36 to your computer and use it in GitHub Desktop.
IIS URLRewrite Rule - Remove Port From ForwardedFor Header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<configuration> | |
<configSections> | |
<!-- config sections --> | |
</configSections> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Remove Port From ForwardedFor Header"> | |
<match url="(.*)" /> | |
<serverVariables> | |
<set name="HTTP_X_FORWARDED_FOR" | |
value="{C:1}{C:3}" /> | |
</serverVariables> | |
<action type="None" /> | |
<conditions trackAllCaptures="true"> | |
<add input="{HTTP_X_FORWARDED_FOR}" | |
pattern="^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}):([0-9]{1,5})(.*)$" /> | |
</conditions> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment