How to send proxy cache status to backend server?

Makailol Charls makailol7 at
Thu Mar 27 09:31:22 UTC 2014

Hi Maxim,

Apart from passing cache status to backend, would it be possible to send
some other headers which are stored in cache?

For example, If backed sets header "Foo : Bar" , which is stored in cache.
Now when cache is expired , request will be sent to backend. At that time
can we send the value of Foo header stored in cache to upstream backend?

I tried to achieve this with below code but it could not work.
proxy_set_header Foo  $upstream_http_Foo;

Would you suggest me how to achieve this or what am I doing wrong here.


On Thu, Mar 20, 2014 at 6:56 PM, Maxim Dounin <mdounin at> wrote:

> Hello!
> On Thu, Mar 20, 2014 at 09:38:40AM +0530, Makailol Charls wrote:
> > Hi,
> >
> > Is there some way to achieve this? I want to pass requests to backend
> based
> > on cache status condition.
> This is not something easily possible, as cache status is only
> known after we started processing proxy_pass and already know
> which backend will be used.  (Note that by default proxy_cache_key
> uses $proxy_host, which wouldn't be known otherwise.)
> If you want to check BYPASS as in your previous message, I would
> recommend checking relevant conditions from proxy_cache_bypass
> separately.  As a more generic though less effective aproach, an
> additional proxy layer may be used.
> --
> Maxim Dounin
> _______________________________________________
> nginx mailing list
> nginx at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list