How to send proxy cache status to backend server?

Maxim Dounin mdounin at mdounin.ru
Thu Mar 20 13:26:36 UTC 2014


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/



More information about the nginx mailing list