IIS 10反向代理在图像上抛出404

时间:2019-11-07 14:34:50

标签: iis reverse-proxy iis-10 arr

我遵循了这份出色的指南,内容涉及如何设置IIS 10反向代理以从Internet打开我的后端akeneo服务器。

(这个:https://techcommunity.microsoft.com/t5/IIS-Support-Blog/Setup-IIS-with-URL-Rewrite-as-a-reverse-proxy-for-real-world/ba-p/846222#M343

除了我不显示图像,它工作正常。我在IIS日志中看到所有jpg文件的404错误(图像文件下方的1行是404,第二行是正常的200)

2019-11-07 14:26:30 192.168.1.253 GET /media/show/1%2F8%2F8%2F8%2F188838fd29a44f7eed902ebfe51926bcbf4fe24b_90036_Herbovet_Herbintest_1_L.jpg/thumbnail_small - 80 - 81.241.239.100 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/78.0.3904.87+Safari/537.36 http://ake.xxx.be/ 404 11 0 1
2019-11-07 14:26:30 192.168.1.253 GET /configuration/attribute-option/attribute/nett_content_unit/option options%5Bidentifiers%5D%5B%5D=liter&X-ARR-CACHE-HIT=0&X-ARR-LOG-ID=6d444c39-ea68-407a-969d-5ae2c5fcaad8&SERVER-STATUS=200 80 - 81.241.239.100 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/78.0.3904.87+Safari/537.36 http://ake.xxx.be/ 200 0 0 246

这是Windows Server 2019 IIS 10上的后端。后端是运行Akeneo的Ubuntu 18.04上的Apache。

这是我的web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://192.168.1.252/{R:1}" />
                    <serverVariables>
                        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
                        <set name="HTTP_ACCEPT_ENCODING" value="" />
                    </serverVariables>
                </rule>
            </rules>
            <outboundRules>
                <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
                    <match filterByTags="A, Form, Img" pattern="^http(s)?://192.168.1.252/(.*)" />
                    <action type="Rewrite" value="http{R:1}://ake.xxx.be/{R:2}" />
                </rule>
                <rule name="RestoreAcceptEncoding" preCondition="NeedsRestoringAcceptEncoding">
                    <match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" />
                    <action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
                </rule>
                <preConditions>
                    <preCondition name="ResponseIsHtml1">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                    </preCondition>
                    <preCondition name="NeedsRestoringAcceptEncoding">
                        <add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
                    </preCondition>
                </preConditions>
            </outboundRules>
        </rewrite>
        <caching>
            <profiles>
                <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="DisableCache" />
            </profiles>
        </caching>
    </system.webServer>
</configuration>

如果需要更多信息,请告诉我。 谢谢, 汤姆

1 个答案:

答案 0 :(得分:0)

404.11-请求包含双重转义序列。 要解决此问题,您可以尝试以下操作:

1)打开iis管理器选择站点。

2)单击请求过滤功能。从操作窗格中选择“编辑功能设置”。

3)选中允许两次转义。

enter image description here

另外,请参考此链接以获取更多详细信息:

https://blogs.msdn.microsoft.com/carlosag/2010/04/01/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr/