【问题标题】:IIS URL Rewrite Rules With Reverse Proxy - HTTP Error 500.52使用反向代理的 IIS URL 重写规则 - HTTP 错误 500.52
【发布时间】:2020-05-23 00:46:17
【问题描述】:

我们在 Windows Server 2019 上运行 IIS 10。我们在 localhost 的本地服务器上运行 EmbedIO。在 IIS 中,我们使用 URL 重写创建了反向代理规则。该网站在您第一次加载页面时没有任何问题。如果您点击刷新,浏览器会显示以下错误:

HTTP 错误 500.52 - URL 重写模块错误。*

当 HTTP 响应的内容被编码(“gzip”)时,不能应用出站重写规则。

如果您再次点击刷新并且页面正常加载。这种情况一遍又一遍地发生,页面加载正确,然后你点击刷新,你会收到这个:

500.52 错误信息

下面是我们正在使用的网络配置文件。出于安全考虑,我更改了我们服务器的名称。是否有人发现我们的配置有任何问题,或者他们可以建议我对规则进行任何更改吗?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
    <rewrite>
        <outboundRules>
            <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
                <match filterByTags="A, Form, Img" pattern="^http(s)?://localhost:8686/(.*)" />
                <action type="Rewrite" value="http{R:1}://server1.mydomain.com/{R:2}" />
            </rule>
            <preConditions>
                <preCondition name="ResponseIsHtml1">
                    <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                </preCondition>
               </preConditions>
        </outboundRules>
        <rules>
            <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                <match url="(.*)" />
                <action type="Rewrite" url="http://localhost:8686/{R:1}" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
 <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" />
</system.web>
</configuration> 

提前致谢,

-麦克

【问题讨论】:

    标签: reverse-proxy iis-10 windows-server-2019


    【解决方案1】:

    根据您的描述,我建议您可以尝试禁用代理服务器 A 和后端服务器 B 的动态和静态内容压缩。

    关于如何禁用和静态内容压缩的详细信息,您可以参考这篇文章: https://www.saotn.org/iis-outbound-rules-with-gzip-compression/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-22
      • 2018-03-21
      • 2020-09-05
      • 1970-01-01
      • 1970-01-01
      • 2018-07-23
      • 2020-08-03
      • 2020-07-29
      相关资源
      最近更新 更多