Next upstream based on custom http code

Frank Liu gfrankliu at gmail.com
Fri Dec 11 09:05:40 UTC 2015


Here is my flow: client - nginx - upstream - real upstream

Upstream is getting the response from the 'real' upstream. So if real
upstream is wrong, nginx will get standard 5xx from upstream and in this
case I don't really want nginx to try next upstream because it will hit the
same bad real upstream with the same error code. In other cases where real
upstream is good but one upstream is having too much load or wants to
finish up in flight requests then go down for maintenance , is it possible
for upstream to send a soft error code to nginx to tell it try next
upstream.?

On Friday, December 11, 2015, B.R. <reallfqq-nginx at yahoo.fr> wrote:

> If the upstream refuses to process a request, you might wish to emulate an
> unavailable service or a lack of response (timeout). Backend up and working
> are expected to process requests.
> Switching between legitimate errors and faked one will be done by
> monitoring backend logs.
>
> There is no such thing as a 'Coffee Break' HTTP code. :oP
> ---
> *B. R.*
>
> On Thu, Dec 10, 2015 at 9:20 PM, Frank Liu <gfrankliu at gmail.com
> <javascript:_e(%7B%7D,'cvml','gfrankliu at gmail.com');>> wrote:
>
>> No, 503 may be a legitimate error from upstream that nginx needs to pass
>> to client.
>> I am thinking some unused code , say, 590.
>>
>>
>> On Thursday, December 10, 2015, B.R. <reallfqq-nginx at yahoo.fr
>> <javascript:_e(%7B%7D,'cvml','reallfqq-nginx at yahoo.fr');>> wrote:
>>
>>> Like... 503?
>>> To me 'server wants to make another upstream dealing with the request'
>>> sounds very much like 'Service Unavailable'.
>>> ---
>>> *B. R.*
>>>
>>> On Thu, Dec 10, 2015 at 5:34 PM, Frank Liu <gfrankliu at gmail.com> wrote:
>>>
>>>> Hi
>>>>
>>>> There are a few options for when to try next upstream :
>>>> http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream
>>>>
>>>> Is it possible to configure a custom http code so that upstream servers
>>>> can send that code if it wants to send nginx to upstream ?
>>>>
>>>> Thanks
>>>> Frank
>>>>
>>>> _______________________________________________
>>>> nginx mailing list
>>>> nginx at nginx.org
>>>> http://mailman.nginx.org/mailman/listinfo/nginx
>>>>
>>>
>>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org <javascript:_e(%7B%7D,'cvml','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/20151211/655d645a/attachment.html>


More information about the nginx mailing list