COUNTRY_PATH という IIS サーバーで使用できるサーバー変数を設定しました。
あるサイトから別のサイトへのリバース プロキシの書き換えを行っており、プロキシされたサイトでこのサーバー変数にアクセスする必要があります。しかし、それは決して価値があるようには見えません。
<rule name="Country Codes For DotCom" stopProcessing="true">
<match url="^([A-Z]{2,2})(/)(microsite)(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="\.com$" />
</conditions>
<serverVariables>
<set name="COUNTRY_PATH" value="{R:1}{R:2}{R:3}" />
</serverVariables>
<action type="Rewrite" url="http://internal.example.com/{R:1}{R:2}{R:3}{R:4}" />
</rule>
サーバー変数はリバース プロキシで使用できますか?
次のコードを使用してサーバー変数を取得しています。
string countryPath = HttpContext.Current.Request.ServerVariables["COUNTRY_PATH"]
誰かが私が間違っていることを提案できますか?