Welcome! Log In Create A New Profile

Advanced

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

Ryan Malayter
March 12, 2010 12:14AM
2010/3/5 杨春宇 <yangchunyu@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@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

yangchunyu March 03, 2010 12:24PM

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

Mirosław Jaworski March 03, 2010 01:30PM

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

杨春宇 March 05, 2010 02:30AM

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

Ryan Malayter March 12, 2010 12:14AM

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

杨春宇 March 12, 2010 08:44AM

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

Ryan Malayter March 12, 2010 11:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 199
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready