HttpLuaModule create asynchronous subrequests
Guido Accardo
guido at motrixi.com
Fri Nov 14 19:20:55 UTC 2014
Hello,
On Thu, Nov 13, 2014 at 5:24 PM, Yichun Zhang (agentzh) <agentzh at gmail.com>
wrote:
> 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.
>
Using "proxy_ignore_client_abort on;" as you suggested worked for me.
>From the doc of proxy_ignore_client_abort:
" ... Determines whether the connection with a proxied server should be
closed when a client closes the connection without waiting for a response
..."
So basically I'm discarding dev's responses ?
>
> >
> > 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).
>
I'm going for this solution, the ugly hack will be my second option but
this seems great.
>
> 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.
>
I'll definitely do it!
>
> For your very use case, maybe lower level tools like tcpcopy [4] is a
> better fit? Not sure though :)
>
I gave it a try, also https://www.npmjs.org/package/duplicator and traffic
mirroring with iptables TEE module, but anyway the library that you
suggested.
Thank you,
Best Regards,
>
> 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
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
--
---
Guido Accardo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141114/33faeac8/attachment.html>
More information about the nginx
mailing list