首页 > 其他分享 >IIS URL重写实现代理输出

IIS URL重写实现代理输出

时间:2022-10-09 09:12:42浏览次数:48  
标签:输出 IIS URL 代理 https 重写

由于某些需要,我们可能需要通过代理输出其它服务器内容,并用使用https。下面使用两条规则,先转向https然后再使用代理输出。IIS版本需要7.0及以上版本

 

在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="newzzrd">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_HOST}" pattern="^admin.zzrd.gov.cn$" />
                    </conditions>
                    <action type="Rewrite" url="http://123.180.213.36:7081/{R:1}" />
                </rule>
               

</rules>

</rewrite>
 </system.webServer>

 

需要用到的IIS插件:

 

 

标签:输出,IIS,URL,代理,https,重写
From: https://www.cnblogs.com/fogwang/p/16770938.html

相关文章