我们遇到了令人讨厌的零星IE6错误,其中在js和css文件上启用了gzip压缩会使事情变糟(例如参见Can i gzip-compress all my html content(pages))。IE6 gzip错误和IIS7 URL重写模块
因此,处理这个问题似乎是最好的方法,那就是使用IIS7/7.5中的URL重写模块来检查来自< IE6的请求,并根据http://sebduggan.com/posts/ie6-gzip-bug-solved-using-isapi-rewrite对其进行解压缩。
- 我想用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>
要放什么东西在服务器变量接受编码?我已经证实,这是问题线(因为所有其他东西都被隔离并按要求运行)。我尝试了所有我能想到的,我开始认为只是不支持设置Accept-Encoding标头。
我试着:
<set name="HTTP_ACCEPT_ENCODING" value=" " />
<set name="HTTP_ACCEPT_ENCODING" value=".*" />
<set name="HTTP_ACCEPT_ENCODING" value="0" />
具体地,它导致 “HTTP/1.1 500 URL重写模块错误”。