recursive_error_pages limited to a chain of 11?

Maxim Dounin mdounin at mdounin.ru
Tue Sep 25 14:27:43 UTC 2012


Hello!

On Tue, Sep 25, 2012 at 09:41:57AM -0400, o456092 at rtrtr.com wrote:

> Hi,
> 
> I have configured NGINX as an HTTP Asset locator, where the assets might
> found through a series of recursive errors by sequentially a series of
> different webservers. The problem that "I think" I have ran into, is that
> NGINX's recursive_error_pages is limited to a depth 11 servers, thus 11
> errors 404 or 500 errors- is this a fact? Interesting enough I get a 500
> internal server error when I hit this 11th member in the chain.

Yes, see http://nginx.org/r/internal:

: There is a limit of 10 internal redirects per request to prevent 
: request processing cycles that can occur in incorrect 
: configurations. If this limit is reached, the error 500 (Internal 
: Server Error) is returned. In such cases, the “rewrite or internal 
: redirection cycle” message can be seen in the error log.

> I have tested various scenarios and I always seem to be blocked at the 11th
> cascading call with a 500 error - I move different servers around in fear
> that one of them (upstream servers) had a problem, but it was not specific
> to a server, regardless which asset I was going after
> http:<mynginx>/srv<n>/file<n> - once it hit 11 in depth.
> 
> Anyone has any ideas of this limitation - or is there something that could
> be done?

If you *reallly* want to do things that way - you may try hacking 
src/http/ngx_http_request.h to bump NGX_HTTP_MAX_URI_CHANGES 
define.  But I would recommend rethinking your aproach and e.g.  
use single upstream block (or couple of upstream blocks) with 
proxy_next_upstream instead.

-- 
Maxim Dounin
http://nginx.com/support.html



Подробная информация о списке рассылки nginx-ru