# Mark upstream proxy inoperable based on response body or arbitrary http status?

**URL:** <https://www.ruby-forum.com/t/mark-upstream-proxy-inoperable-based-on-response-body-or-arbitrary-http-status/222003>\
**Category:** NGINX\
**Created:** [August 8, 2012, 9:37pm UTC](https://www.ruby-forum.com/t/mark-upstream-proxy-inoperable-based-on-response-body-or-arbitrary-http-status/222003 "2012-08-08T21:37:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 8, 2012, 9:37pm UTC](https://www.ruby-forum.com/t/mark-upstream-proxy-inoperable-based-on-response-body-or-arbitrary-http-status/222003/1 "2012-08-08T21:37:51Z")

</div>

Hi,

I just started playing with Nginx. My goal is to rate limit requests to  
a set of backend proxies, and it looks like I want to do this using the  
modules HttpUpstreamModule, HttpProxyModule, and HttpLimitReqModule  
modules.

I see that HttpUpstreamModule marks an upstream server as inoperable  
based on the setting of proxy\_next\_upstream. However, I need to be able  
to mark a server as inoperable given conditions that I don’t appear to  
be able to set. Specifically, if I could examine the results of a server  
response and mark it inoperable, or operable, based on the contents,  
that’d be best. Another, possibly less complicated solution would be for  
me to mark a server inoperable if the http status in the response is  
302, but I don’t see a “http\_302” for proxy\_next\_upstream.

It would also be great if the amount of time before re-checking a server  
marked as inoperable was configurable separate from HttpUpstreamModule’s  
fail\_timeout (so I could say something like, if a server fails once in 1  
second mark it inoperable, but don’t try to check it again for 3  
hours).

Am I overlooking options to do what I want to do here?

Thanks!  
Andy

Posted at Nginx Forum:

> **[Mark upstream proxy inoperable based on response body or arbitrary http status?](https://forum.nginx.org/read.php?2,229472,229472#msg-229472)**
>
> Hi, I just started playing with Nginx. My goal is to rate limit requests to a set of backend proxies, and it looks like I want to do this using the modules HttpUpstreamModule, HttpProxyModule, and HttpLimitReqModule modules. I see that...

---

<div class="post-metadata">

**Author:** ![vdavidoff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/50afbb/32.png) [@vdavidoff](https://www.ruby-forum.com/u/vdavidoff)\
**Post date:** [August 9, 2012, 3:20am UTC](https://www.ruby-forum.com/t/mark-upstream-proxy-inoperable-based-on-response-body-or-arbitrary-http-status/222003/2 "2012-08-09T03:20:40Z")

</div>

I tried playing with proxy\_intercept\_errors and error\_page to change  
302s to 500s, then added http\_500 to proxy\_next\_upstream, but this  
doesn’t seem to mark a proxy as down. I assume as far as  
HttpUpstreamModule is concerned, the response is a 302, prior to it  
being converted to a 500 (?).

Andy

Posted at Nginx Forum:

> **[Re: Mark upstream proxy inoperable based on response body or arbitrary http...](https://forum.nginx.org/read.php?2,229472,229487#msg-229487)**
>
> Hi, I just started playing with Nginx. My goal is to rate limit requests to a set of backend proxies, and it looks like I want to do this using the modules HttpUpstreamModule, HttpProxyModule, and HttpLimitReqModule modules. I see that...

---

<div class="post-metadata">

**Author:** ![vdavidoff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/50afbb/32.png) [@vdavidoff](https://www.ruby-forum.com/u/vdavidoff)\
**Post date:** [August 9, 2012, 5:40am UTC](https://www.ruby-forum.com/t/mark-upstream-proxy-inoperable-based-on-response-body-or-arbitrary-http-status/222003/3 "2012-08-09T05:40:52Z")

</div>

I did something I am sure is terrible and hacked up the source so that I  
could use http\_302 along with proxy\_next\_upstream. This appears to do  
what I want, though now I am not sure that HttpLimitReqModule can  
actually do what I need.

Andy

Posted at Nginx Forum:

> **[Re: Mark upstream proxy inoperable based on response body or arbitrary http...](https://forum.nginx.org/read.php?2,229472,229489#msg-229489)**
>
> Hi, I just started playing with Nginx. My goal is to rate limit requests to a set of backend proxies, and it looks like I want to do this using the modules HttpUpstreamModule, HttpProxyModule, and HttpLimitReqModule modules. I see that...
