nginx+lua reverse proxy empty body (weird repeatable behavior)
agentzh at gmail.com
Fri Nov 30 02:15:44 UTC 2012
On Thu, Nov 29, 2012 at 1:51 AM, Bart van Deenen wrote:
> It seems the body_filter_by_lua section is bypassed somehow, it just doesn't receive the proxied data. I have this simplified testcase which at least for my setup is completely repeatable. See below.
With your (exact) code sample, I cannot see any issues with
ngx_openresty 188.8.131.52 on Linux x86_64.
For a *single* request to location / (note: not multiple!), I'm
getting 26 non-empty data chunks:
$ grep 'The body is' logs/error.log | wc -l
and also one empty data chunk (which is generated by ngx_proxy to
solely signal the end of the body):
$ grep 'has empty body' logs/error.log | wc -l
You can try to scan your error.log on your side.
For big enough response bodies, it's common to see multiple data
chunks emitted by ngx_proxy to the output body filter chain. And your
body_filter_by_lua handler will be called multiple times, one time for
one data chunk, for a *single* response.
BTW, please post such questions to the openresty-en mailing list
(https://groups.google.com/group/openresty-en ) instead so that I can
see your mails sooner rather than later :)
More information about the nginx