Roman Arutyunyan
July 06, 2015 11:46AM
> On 06 Jul 2015, at 16:49, sz_g <> wrote:
> I've just created a configuration composed of two servers.
> Both just forwards traffic from different ports (and protocols) to different
> servers, and keep responses in cache. It works nice.
> For both servers "GET /" request is sent, in the response there is proper
> resource. Thus (to distinguish responses in the cache) I added for both
> cache_key:
> proxy_cache_key "$upstream_addr*$request”;

At the time when this expression is evaluated, $upstream_addr is still unknown
since no upstream connection is made. Obviously, if a key is found in cache,
there will be no upstream connection at all. So it’s not a good idea to use
$upstream_addr in key definition. Instead, you can use the parts of request
which define the upstream address.

> But it doesn't work. I found that upstream states are not available and thus
> "proxied" address is not known when cache key is computed. And "proxied"
> address is computed only when additional stream must be used..
> Is there any way to get proper key? Or any other way to keep all copies in
> the cache?
> I plan to add "load balancing" module, which would be able to forward
> request on (multiple) source addresses to multiple proxied addresses, with
> caching.. Will it work properly?
> Posted at Nginx Forum:,260086,260086#msg-260086
> _______________________________________________
> nginx mailing list

Roman Arutyunyan

nginx mailing list
Subject Author Posted

proxy_cache_key with variables

sz_g July 06, 2015 09:49AM

Re: proxy_cache_key with variables

xnirchan July 06, 2015 10:05AM

Re: proxy_cache_key with variables

Roman Arutyunyan July 06, 2015 11:46AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 329
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready