, , - URL- IIS HTTPS SERVER_PORT, - , . Web.config:
<rewrite>
<allowedServerVariables>
<add name="HTTPS" />
<add name="SERVER_PORT" />
</allowedServerVariables>
<rules>
<rule name="backend" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" />
</conditions>
<serverVariables>
<set name="HTTPS" value="on" />
<set name="SERVER_PORT" value="443" />
</serverVariables>
<action type="None" />
</rule>
</rules>
</rewrite>
, , X-Forwarded-Proto, https, HTTPS SERVER_PORT, , HTTPS. , X-Forwarded-Proto .
, URL Rewrite , , HTTP. - IIS, URL- - . IIS URL .
, <allowedServerVariables> Web.config . , , -. script URL- -:
Param(
[string] $package = 'rewrite_2.0_rtw_x64.msi'
)
Start-Process -Wait msiexec -ArgumentList @('/i', $package, '/quiet', '/qn', '/norestart')
$applicationHost = "C:\Windows\System32\inetsrv\config\applicationHost.config"
$config = [xml](Get-Content $applicationHost)
$webServer = $config.configuration.configSections.sectionGroup | where {$_.name -eq "system.webServer"}
$rewrite = $webServer.sectionGroup | where {$_.name -eq "rewrite"}
$serverVariables = $rewrite.section | where {$_.name -eq "allowedServerVariables"}
$serverVariables.SetAttribute("overrideModeDefault", "Allow")
$config.Save($applicationHost)