Forward request after operation with worker?

Yichun Zhang (agentzh) agentzh at gmail.com
Thu Nov 26 04:14:40 UTC 2015


Hello!

On Wed, Nov 18, 2015 at 6:48 AM, Stephane Wirtel wrote:
> With a request, is it possible to redirect to a running worker and if
> this one is not running, just enable it.
>
> I explain, I would like to implement a reverse proxy with Lua and
> OpenResty and Redis.
>
> Redis will store a mapping between the hostname and a tuple (ip of the
> worker:port).
>
> But the workers can be down, because unused in time.
>
> I was thinking to keep the request, execute a "light thread" in Lua
> (with a timeout of 1s). The light thread will active the worker.
> If the timeout is reached, we return an error, else we send the request
> to the worker.
>
> 1. Is it possible ?
> 2. I would like to know how will you make that, I don't know Lua, just used
> it in the past just for small scripts with imapfilter or a PoC with
> OpenResty.

Sorry, I don't really understand what you're trying to achieve. Are
you trying to make the nginx workers talk to each other? Maybe you can
use the lua_shared_dict to share your data among them?

BTW, it's recommended to post to the openresty-en mailing list for
OpenResty specific questions. Please see
https://openresty.org/#Community Thanks!

Best regards,
-agentzh



More information about the nginx mailing list