How to set the X-Forwarded-For header on IIS reverse proxy setup?
I found the answer.In Application Request Routing Cache-->Server Proxy Settings-->Preserve client IP in the following header--> leave it blank.
http://technet.microsoft.com/en-us/library/dd443533(v=ws.10).aspx
Preserve client IP in the following header:
Indicates whether the header should keep the client IP address for the specified header value. The default value is X-Forwarded-For. If you leave this field blank, then no client IP address will be passed through as a custom header to the application server.
JohnnyLiao
Updated on August 23, 2020Comments
-
JohnnyLiao over 3 years
When using IIS as a reverse proxy I want to pass through the IP address of the remote user to my backend web server. This must be done using the X-Forwarded-For header.I want only keep remote user IP in X-Forwarded-For header, which clears out any other proxy server IP.
So I using Url rewrite proxy to test if the X-Forwarded-For could be modified. this is my settings:
<rule name="replace X forward for"> <match url=".*" /> <serverVariables> <set name="HTTP_X_FORWARDED_FOR" value="100.100.100.100" /> </serverVariables> <action type="None" /> </rule>
before my testing X-FORWARDED-FOR:10.87.50.47.51579
after my test: X-FORWARDED-FOR:100.100.100.100,10.87.50.47.51579
Why can't replace the original value? Or is there any other way to modify X-Forwarded-For header?
Any help I would appricaite! Thanks