IIS URL重写实现代理输出
由于某些需要,我们可能需要通过代理输出其它服务器内容,并用使用https。下面使用两条规则,先转向https然后再使用代理输出。IIS版本需要7.0及以上版本
另外使用http to https需要注意,IIS上的域名解析是否绑定80端口
IIS 8.0 以上版本需要使用 Application Request Routing支持
1、打开web平台组件或者网址https://www.microsoft.com/en-us/download/confirmation.aspx?id=47333直接下载安装

2、搜索路由关键字

3、安装后重新打开IIS,点击Application Request Routing

打开点击启用代理:

4、点击 Server Proxy Settings

5、点击Enable proxy即可,其它不用变,点击应用,再设置Url Rwrite 重写
在web.config配置如下:
<system.webServer>
<rewrite>
<rules>
<rule name="http to https" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" logRewrittenUrl="false" redirectType="Temporary" />
</rule>
<rule name="newxx">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^admin.xx.cn$" />
</conditions>
<action type="Rewrite" url="http://123.190.213.36:7081/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
需要用到的IIS插件:


浙公网安备 33010602011771号