Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iis 7 IE6 gzip错误和IIS7 URL重写模块_Iis 7_Url Rewriting - Fatal编程技术网

Iis 7 IE6 gzip错误和IIS7 URL重写模块

Iis 7 IE6 gzip错误和IIS7 URL重写模块,iis-7,url-rewriting,Iis 7,Url Rewriting,我们遇到了令人讨厌的零星IE6错误,在js和css文件上启用gzip压缩会使事情变得糟糕(参见示例) 因此,处理这一问题的最佳方法似乎是使用IIS7/7.5中的URL重写模块来检查来自

我们遇到了令人讨厌的零星IE6错误,在js和css文件上启用gzip压缩会使事情变得糟糕(参见示例)

因此,处理这一问题的最佳方法似乎是使用IIS7/7.5中的URL重写模块来检查来自
  • 我想使用IIS7 Url重写模块
  • 只有IIS7 Url重写模块2.0 RC支持重写标头
  • 但以下结果会导致受影响资源的错误为500:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="IE56 Do not gzip js and css" stopProcessing="true">
                    <match url="\.(css|js)" />
                    <conditions>
                        <add input="{HTTP_USER_AGENT}" pattern="MSIE\ [56]" />
                    </conditions>
                    <action type="None" />
                    <serverVariables>
                        <set name="Accept-Encoding" value=".*" /> <!-- This is the problem line -->
                    </serverVariables>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
    
    
    

    在接受编码的服务器变量中放入什么?我已经验证了这是问题线(因为其他一切都已隔离并按要求运行)。我已经尝试了我所能想到的一切,我开始认为不支持设置接受编码头

    我试过:

    <set name="HTTP_ACCEPT_ENCODING" value=" " />
    <set name="HTTP_ACCEPT_ENCODING" value=".*" />
    <set name="HTTP_ACCEPT_ENCODING" value="0" />
    
    
    

    具体来说,它会导致“HTTP/1.1500 URL重写模块错误”。

    事实证明,出于安全原因,您需要在applicationHost.config中显式允许您希望修改的任何服务器变量(请参阅)

    因此,在Web.config中执行以下操作:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="IE56 Do not gzip js and css" stopProcessing="false">
                    <match url="\.(css|js)" />
                    <conditions>
                        <add input="{HTTP_USER_AGENT}" pattern="MSIE\ [56]" />
                    </conditions>
                    <action type="None" />
                    <serverVariables>
                        <set name="HTTP_ACCEPT_ENCODING" value="0" />
                    </serverVariables>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
    
    
    一篇详细介绍一切的博客文章

    编辑:添加了官方文档链接


    编辑:添加了博客文章摘要的链接。

    事实证明,出于安全原因,您需要在applicationHost.config中显式允许您希望修改的任何服务器变量(请参阅)

    因此,在Web.config中执行以下操作:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="IE56 Do not gzip js and css" stopProcessing="false">
                    <match url="\.(css|js)" />
                    <conditions>
                        <add input="{HTTP_USER_AGENT}" pattern="MSIE\ [56]" />
                    </conditions>
                    <action type="None" />
                    <serverVariables>
                        <set name="HTTP_ACCEPT_ENCODING" value="0" />
                    </serverVariables>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
    
    
    一篇详细介绍一切的博客文章

    编辑:添加了官方文档链接

    编辑:添加了博客文章摘要的链接