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

Mirosław Jaworski mjaw at ikp.pl
Wed Mar 3 21:25:19 MSK 2010


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?




More information about the nginx mailing list