<div dir="ltr"><div><div><div><div><div>Hi,<br><br></div>In my configuration I have caching layer of Nginx and a separate proxy layer which works as reverse proxy to original upstream backend.<br><br></div>As discussed previously we can pass cache status from caching layer to upstream but is there anything else which I can get from cache file (when cache is expired) and pass to upstream?<br>

<br></div>I want to set some condition to my proxy layer to select original upstream based on that.<br><br></div>Thanks,<br></div>Makailol<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 27, 2014 at 6:19 PM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<div class=""><br>
On Thu, Mar 27, 2014 at 05:08:31PM +0530, Makailol Charls wrote:<br>
<br>
> Hi,<br>
><br>
</div><div class="">> Would it be possible to add this as new feature?<br>
><br>
> Is there some other alternative ? Actually based on this header value I<br>
> want to select named based location.<br>
<br>
</div>Response headers of expires cached responses are not read from a<br>
cache file.  If you really want this to happen, you may try to<br>
implement this, but I don't it's looks like a generally usable<br>
feature.  In most if not all cases it will be just a waste of<br>
resources.<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
><br>
> Thanks,<br>
> Makailol<br>
><br>
><br>
> On Thu, Mar 27, 2014 at 5:02 PM, Maxim Dounin <<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>> wrote:<br>
><br>
> > Hello!<br>
> ><br>
> > On Thu, Mar 27, 2014 at 03:01:22PM +0530, Makailol Charls wrote:<br>
> ><br>
> > > Hi Maxim,<br>
> > ><br>
> > > Apart from passing cache status to backend, would it be possible to send<br>
> > > some other headers which are stored in cache?<br>
> > ><br>
> > > For example, If backed sets header "Foo : Bar" , which is stored in<br>
> > cache.<br>
> > > Now when cache is expired , request will be sent to backend. At that time<br>
> > > can we send the value of Foo header stored in cache to upstream backend?<br>
> > ><br>
> > > I tried to achieve this with below code but it could not work.<br>
> > > proxy_set_header Foo  $upstream_http_Foo;<br>
> > ><br>
> > > Would you suggest me how to achieve this or what am I doing wrong here.<br>
> ><br>
> > This is not something possible.<br>
> ><br>
> > ><br>
> > > Thanks,<br>
> > > Makailol<br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > On Thu, Mar 20, 2014 at 6:56 PM, Maxim Dounin <<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>><br>
> > wrote:<br>
> > ><br>
> > > > Hello!<br>
> > > ><br>
> > > > On Thu, Mar 20, 2014 at 09:38:40AM +0530, Makailol Charls wrote:<br>
> > > ><br>
> > > > > Hi,<br>
> > > > ><br>
> > > > > Is there some way to achieve this? I want to pass requests to backend<br>
> > > > based<br>
> > > > > on cache status condition.<br>
> > > ><br>
> > > > This is not something easily possible, as cache status is only<br>
> > > > known after we started processing proxy_pass and already know<br>
> > > > which backend will be used.  (Note that by default proxy_cache_key<br>
> > > > uses $proxy_host, which wouldn't be known otherwise.)<br>
> > > ><br>
> > > > If you want to check BYPASS as in your previous message, I would<br>
> > > > recommend checking relevant conditions from proxy_cache_bypass<br>
> > > > separately.  As a more generic though less effective aproach, an<br>
> > > > additional proxy layer may be used.<br>
> > > ><br>
> > > > --<br>
> > > > Maxim Dounin<br>
> > > > <a href="http://nginx.org/" target="_blank">http://nginx.org/</a><br>
> > > ><br>
> > > > _______________________________________________<br>
> > > > nginx mailing list<br>
> > > > <a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
> > > > <a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
> > > ><br>
> ><br>
> > > _______________________________________________<br>
> > > nginx mailing list<br>
> > > <a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
> > > <a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
> ><br>
> ><br>
> > --<br>
> > Maxim Dounin<br>
> > <a href="http://nginx.org/" target="_blank">http://nginx.org/</a><br>
> ><br>
> > _______________________________________________<br>
> > nginx mailing list<br>
> > <a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
> > <a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
> ><br>
<br>
> _______________________________________________<br>
> nginx mailing list<br>
> <a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
> <a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
<br>
<br>
--<br>
Maxim Dounin<br>
<a href="http://nginx.org/" target="_blank">http://nginx.org/</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div>