ngx_lua + proxy_next_upstream

Yichun Zhang (agentzh) agentzh at gmail.com
Fri Sep 20 00:34:01 UTC 2013


Hello!

On Wed, Sep 18, 2013 at 6:09 AM, Jedrzej Nowak wrote:
> The question is how can I archive proxy_next_upstream.
> Preferably I would like to return to lua with a error reason.
> If the only way is to return several servers in upstream from lua, how to do
> so ?
>

If you want to return the control back to Lua and let your Lua code do
the upstream retries or something, then you should use the
ngx.location.capture() API instead to initiate an Nginx subrequest to
ngx_proxy:

    http://wiki.nginx.org/HttpLuaModule#ngx.location.capture

Regards,
-agentzh



More information about the nginx mailing list