How to send proxy cache status to backend server?
Makailol Charls
makailol7 at gmail.com
Wed Mar 19 10:00:03 UTC 2014
One more thing I would like to know, would it be possible to proxy_pass
request conditionally based on $upstream_cache_status ?
For example here we set request header with proxy_set_header Cache-Status
$upstream_cache_status; instead we can use condition like below,
if ($upstream_cache_status = "BYPASS") {
proxy_pass http://someIP;
}
if ($upstream_cache_status = "MISS") {
proxy_pass http://anotherIP;
}
I tried this but could not find this working. I can set request header for
backend with proxy_set_header but can not use this variable conditionally.
Thanks,
Makailol
On Wed, Mar 19, 2014 at 10:19 AM, Makailol Charls <makailol7 at gmail.com>wrote:
> Thanks, It is working. I was checking wrong variable name.
> I have noticed that when catch is being "REVALIDATED", backend receives
> "EXPIRED" and upstream receives "REVALIDATED". Is this correct ?
>
>
>
>
> On Mon, Mar 17, 2014 at 8:20 AM, Maxim Dounin <mdounin at mdounin.ru> wrote:
>
>> Hello!
>>
>> On Sat, Mar 15, 2014 at 01:14:51PM +0530, Makailol Charls wrote:
>>
>> > I have been using add_header to send cache status to downstream server
>> or
>> > client like this. This is working fine.
>> > add_header Cache-Status $upstream_cache_status;
>> >
>> > Now I tried proxy_set_header to send header to upstream as below.
>> > proxy_set_header Cache-Status $upstream_cache_status;
>> >
>> > But this could not send headers to upstream backend server. I think we
>> can
>> > not use "$upstream_*" variables to send headers to upstream backend.
>> >
>> > Would you suggest me some way to send cache-status to backend upstream
>> > server?
>>
>> The proxy_set_header directive works fine and passes
>> $upstream_cache_status to backends without any problems. Mostly
>> likely you did something wrong in your tests.
>>
>> --
>> Maxim Dounin
>> http://nginx.org/
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140319/d4d33c23/attachment.html>
More information about the nginx
mailing list