测试如下:
Ngnix.conf:
set_escape_uri $escaped_key $key;
srcache_fetch GET /redis_get $key;
srcache_store PUT /redis_set key=$escaped_key&exptime=7200;
srcache_store_statuses 200 301 302;
srcache_ignore_content_encoding off;
gzip on;
gzip_types text/plain application/xml;
gzip_proxied no-cache no-store private expired auth;
-------------------------------------------------------------------------------------------------------------------------------------------
#1 proxy_pass 直接指向 Aps.net + IIS 7.5 , asp.net返回的 Response header:
HTTP/1.1 200 OK
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
Date: Thu, 10 Dec 2015 05:46:55 GMT
注意返回的网页是压缩过的。
redis2_query set $key $echo_request_body
$echo_request_body 是被解压过的网页,是可读的。 Redis里存入是文本
-------------------------------------------------------------------------------------------------------------------------------------------------------------
#2 proxy_pass 直接指向 Varnish(现在用的反向代理) =》 Aps.net + IIS 7.5 , Varnish 返回的 Response header:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
Date: Thu, 10 Dec 2015 03:15:17 GMT
X-Varnish: 26993298 25817401
Age: 8454
Via: 1.1 varnish-v4
Content-Length: 62319
Connection: keep-alive
Accept-Ranges: bytes
$echo_request_body 是压缩的网页,是不可读的。 Redis里存入是二进制的内容.
我想要的结果是在#1的情况下Redis存入的是二进制的压缩的网页内容.