This answer is inspired by Configuring HTTP Request Headers and IIS Server Variables in IIS Documentation. They do something similar, but, oddly enough, this avoids detecting the original URL using HTTP or HTTPS.
First, you need to have administrative access to your IIS server in order to configure the new allowed server variable in the Rewrite URL module. This is described in a related article, but here are the basic steps:
- In IIS Manager, browse to the website or application folder.
- Open the URL Rewrite function.
- In the Actions panel, click View Server Variables ..., then click Add ...
- Enter a name for your server variable.
- HTTP-,
HTTP. , HTTP_X_MY_HEADER X-MY-HEADER.
rewrite {CACHE_URL}. web.config, .
. , .
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="original URL sample" stopProcessing="true">
...
<serverVariables>
<set name="HTTP_X_MY_HEADER" value="{CACHE_URL}" />
</serverVariables>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
, . http://foo.example:80/bar, .