代码改变世界

http 代理

2021-12-05 11:34  qgbo  阅读(120)  评论(0编辑  收藏  举报

一:  安装Application Request Routing

二;   设置 Application Request Routing:

 

 

三:   建立站点代理:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Rewrite rule1 for /home">
                    <match url=".*" />
                    <conditions>
                    </conditions>
                    <action type="Rewrite" url="http://localhost:8088/WeatherForecast" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

 

80 端口代理到8080

再建一个代理,8080 代理到 http://localhost:5000/WeatherForecast

启动调试一个  .net core webapi 站点

浏览器 访问: http://localhost/proxy/xxxx

会访问到:http://localhost:5000/WeatherForecast

打断点到这个Action: 可以看到请求头上的信息