Answer the question
In order to leave comments, you need to log in
How to forward server query variables in IIS 8?
The essence of the problem is this:
There is IIS, some of the requests for which need to be proxyed to nginx. On nginx, you need to make sure that it receives a packet from the ip address of the client, and not the nginx server.
To do this, IIS needs to add an HTTP header to X-Real-IP when proxying, and the problem will be solved.
The problem is that I haven't been able to get IIS to do it.
web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rule name="test2">
<match url="^qwery/(.*)$" />
<action type="Rewrite" url="http://example.ru/{R:0}" appendQueryString="true" logRewrittenUrl="true" />
<serverVariables>
<set name="X-Real-IP" value="{REMOTE_ADDR}" />
<set name="X-Forwarded-For" value="{REMOTE_ADDR}" />
<set name="ORIGINAL_URI" value="http//{HTTP_HOST}" />
</serverVariables>
</rule>
</rules>
</rewrite>
<security>
<requestFiltering allowDoubleEscaping="true" />
</security>
</system.webServer>
</configuration>
Answer the question
In order to leave comments, you need to log in
1) You need to define a variable
-Choose a site
-Redefine URLs (URL Rewrite)
-View server variables (View Rewrite Maps)
-Add (Add Rewrite Map)
-Add HTTP_X_FORWARDED_FOR
2) Define a variable
set name="HTTP_X_FORWARDED_FOR" value="{ REMOTE_ADDR}"
https://docs.microsoft.com/en-us/iis/extensions/ur...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question