302 Redirect only if node is UP !!

shahzaib mushtaq shahzaib.cb at gmail.com
Sat Sep 24 11:35:08 UTC 2016


Hi,

Is there a way we can set NGINX to redirect only if Caching node is UP
otherwise serve from origin server ? Here is more details about the
scenario :

We've two servers (Origin & Cache) & here is the request scenario:

- client (1.1.1.1) requests a file to origin server
- Origin checks if ip is coming from specific ISP(in our case YES 1.1.1.1
belongs to ISP which we want to redirect to caching node for better latency)
- So Origin 302 redirect request to caching node.
- client served by caching node.

Now in case our ONLY single caching node goes down & nginx keeps on
redirecting client to caching node, that would be really bad. So we're
thinking if we could put a condition in NGINX to redirect only if caching
node is UP otherwise redirect should be ignored & request should be served
by Origin.

We know there's also another option which we can explore i.e upstream{} but
it'll proxy requests via Origin which we don't want, the only requirement
is 302 the client.


Need advise from experts here. Thanks in advance !!

Regards.
Shahzaib
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160924/a18fb7fd/attachment.html>


More information about the nginx mailing list