Forward request after operation with worker?

Stephane Wirtel stephane at wirtel.be
Tue Nov 17 22:48:46 UTC 2015


Hi,

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.

Thank you,

Stephane
-- 
Stéphane Wirtel - http://wirtel.be - @matrixise



More information about the nginx mailing list