过去几个小时我一直在阅读人们在IIS中使用反向代理所遇到的问题,而我似乎无法让我的系统工作。
我已经添加了注册表变量,将dynamicCompressionBeforeCache添加到我的web.config中,但是当我通过代理发出请求时IIS仍未添加压缩。
的Web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" enabled="true" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:9555/" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
<urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="false" />
</system.webServer>
</configuration>
请求
GET /kevin/0.txt HTTP/1.1
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: _ga=GA1.2.54902468.1481671910
响应
HTTP/1.1 200 OK
X-Powered-By: ARR/3.0
Date: Sun, 05 Mar 2017 15:07:57 GMT
Content-Length: 2
反向代理服务器代码
const http = require("http");
http.createServer((req, res) => {
res.write("hi");
res.end();
}).listen(9555);