help about how proxy_cache to store differet cache file by httpheader vary Accept-Encoding like squid
杨春宇
yangchunyu at soufun.com
Fri Mar 12 16:38:55 MSK 2010
Thanks a lot, This solution is good
Thanks again!
yahwist
-----邮件原件-----
发件人: Ryan Malayter [mailto:malayter at gmail.com]
发送时间: 2010年3月12日 13:10
收件人: nginx at nginx.org
主题: Re: help about how proxy_cache to store differet cache file by httpheader vary Accept-Encoding like squid
2010/3/5 <yangchunyu at soufun.com>:
> I think use proxy_cache_key to define caching key is good idea .
> but I do not know which variable to use that can distinguish client side
> support compressed or compressed content and store the different cache file.
Here's an example I've used. Of course the upstream server must return
compressed responses to HTTP/1.0 requests, which many do not by
default:
=================
#normalize all accept-encoding headers to just gzip or the empty string
set $myae "";
if ($http_accept_encoding ~* gzip) {
set $myae "gzip";
}
#the following prevents comressed responses from backend
proxy_set_header Accept-Encoding $myae;
proxy_pass http://backend;
#the following uses a combination of URI and the accept-encoding as a
proxy cache key
proxy_cache_key "$host$request_uri$myae";
--
RPM
_______________________________________________
nginx mailing list
nginx at nginx.org
http://nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list