help about how proxy_cache to store differet cache file by httpheader vary Accept-Encoding like squid

杨春宇 yangchunyu at soufun.com
Fri Mar 5 10:23:59 MSK 2010


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.

Can Igor Sysoev help me . Thanks a lot.


                          yangchunyu


-----邮件原件-----
发件人: Miros?aw Jaworski [mailto:mjaw at ikp.pl] 
发送时间: 2010年3月4日 2:25
收件人: nginx at nginx.org
主题: Re: help about how proxy_cache to store differet cache file by
httpheader vary Accept-Encoding like squid

On Thu, 2010-03-04 at 01:19 +0800, yangchunyu wrote:
> We use nginx as reserve proxy server and want use proxy_cache to replace
squid.
> There are apache servers behind nginx, we use deflate module to compress
text/html pages.
> The problem is if proxy_cache has cached the compressed page but the
client side that request page does not support uncompress, the page can not
be see correctly.
> I know squid using http header Accept-Encoding to store different cache
file, but there is no way to use it in nginx proxy_cache_key. 

You can try to use proxy_cache_key to define caching key ( i don't 
know however if you find variable that will do trick ). 

The other method i would think of is not letting nginx to cache
compressed content. And i don't mean caching or not depend on
whether backend response is compressed or not - i mean forcing
uncompressed transmission between nginx and backends.
You may even gain another benefit - lessen the compression burden
on backends which may give you spare cpu cycles on them.

I believe
proxy_set_header  Accept-Encoding  "";
in proxying location is the way to go.

-- 
Miroslaw "Psyborg" Jaworski
GCS/IT d- s+:+ a C++$ UBI++++$ P+++$ L- E--- W++(+++)$ N++ o+ K- w-- O-
M- V- PS+ PE++ Y+ PGP t 5? X+ R++ !tv b++(+++) DI++ D+ G e* h++ r+++ y?


_______________________________________________
nginx mailing list
nginx at nginx.org
http://nginx.org/mailman/listinfo/nginx




More information about the nginx mailing list