How to send proxy cache status to backend server?

Maxim Dounin mdounin at mdounin.ru
Thu Mar 27 12:49:48 UTC 2014


Hello!

On Thu, Mar 27, 2014 at 05:08:31PM +0530, Makailol Charls wrote:

> Hi,
> 
> Would it be possible to add this as new feature?
> 
> Is there some other alternative ? Actually based on this header value I
> want to select named based location.

Response headers of expires cached responses are not read from a 
cache file.  If you really want this to happen, you may try to 
implement this, but I don't it's looks like a generally usable 
feature.  In most if not all cases it will be just a waste of 
resources.

> 
> 
> Thanks,
> Makailol
> 
> 
> On Thu, Mar 27, 2014 at 5:02 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> 
> > Hello!
> >
> > On Thu, Mar 27, 2014 at 03:01:22PM +0530, Makailol Charls wrote:
> >
> > > 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.
> >
> > This is not something possible.
> >
> > >
> > > Thanks,
> > > Makailol
> > >
> > >
> > >
> > >
> > > On Thu, Mar 20, 2014 at 6:56 PM, Maxim Dounin <mdounin at mdounin.ru>
> > 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
> > > > http://nginx.org/
> > > >
> > > > _______________________________________________
> > > > nginx mailing list
> > > > nginx at nginx.org
> > > > http://mailman.nginx.org/mailman/listinfo/nginx
> > > >
> >
> > > _______________________________________________
> > > nginx mailing list
> > > nginx at nginx.org
> > > http://mailman.nginx.org/mailman/listinfo/nginx
> >
> >
> > --
> > Maxim Dounin
> > http://nginx.org/
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> >

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


-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list