HttpLuaModule create asynchronous subrequests
Yichun Zhang (agentzh)
agentzh at gmail.com
Thu Nov 13 20:24:53 UTC 2014
Hello!
On Wed, Nov 12, 2014 at 12:20 PM, Guido Accardo wrote:
>
> Here, prod response is sent immediately as I want and dev receives the
> traffic but the connection is closed the I got a Broken Pipe (which makes
> sense).
>
For this error, maybe you should configure
proxy_ignore_client_abort on;
for your dev location with proxy_pass.
But using ngx.eof() for this will still introduce extra delay for the
subsequent requests on the current downstream connection when HTTP
keepalive or HTTP pipelining is enabled.
>
> Is there a way to do capture calls in a asynchronous mode or to achieve this
> in other way?
>
The recommended way is to use cosocket-based http library like Brian
Akins's lua-resty-http-simple [1] (instead of subrequests and
ngx_proxy) in a 0-delay timer created by ngx.timer.at() [2] (instead
of the ngx.eof hack).
BTW, it's recommended to join the openresty-en mailing list [3] for
such ngx_lua related questions that way you may get more responses and
get responses sooner.
For your very use case, maybe lower level tools like tcpcopy [4] is a
better fit? Not sure though :)
Regards,
-agentzh
[1] https://github.com/bakins/lua-resty-http-simple
[2] https://github.com/openresty/lua-nginx-module#ngxtimerat
[3] https://groups.google.com/group/openresty-en
[4] https://github.com/session-replay-tools/tcpcopy
More information about the nginx
mailing list