iis 反向代理 :
1. 微软文档 https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing
2 示例:实现反向代理,修改响应内容 css js image 302跳转等。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<urlCompression doStaticCompression="false" doDynamicCompression="false" />
<rewrite>
<!-- 请求代理 -->
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:3000/{R:1}" />
</rule>
</rules>
<outboundRules>
<!-- js css 图片路径修改 -->
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" stopProcessing="true">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)" />
<action type="Rewrite" value="/gitserver{R:0}" />
<conditions>
</conditions>
</rule>
<!-- 302跳转 -->
<rule name="Http302" preCondition="Http302">
<match serverVariable="RESPONSE_LOCATION" pattern=".*" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/([^/]+)/.*" />
<add input="{RESPONSE_LOCATION}" pattern="^http[s]?://.*" negate="true" />
</conditions>
<action type="Rewrite" value="/{C:1}{R:0}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
<!-- 302跳转 -->
<preCondition name="Http302">
<add input="{RESPONSE_STATUS}" pattern="302" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
3、相关参考
https://www.cnblogs.com/shamork/p/config_IIS_like_nginx.html
http://blog.bossma.cn/dotnet/iis-reserve-proxy-redirect-302-but-get-404-solution/