I have a similar need to https://github.com/openresty/lua-nginx-module/issues/220
My use case
- I'm forwarding files to a remote server, through using
proxy_pass
. - I need to pass
$body_bytes_sent
to a remote url, after proxy pass. - I thought about doing a
content_by_lua
block, with anngx.capture
forwarded to theproxy_pass
block, with anngx.say()
returning what came fromngx.capture
. Followed by a request with $body_bytes_sent to the remote url. But I need to support streaming, which this wouldn't do. And files can get quite big which is bad forngx.capture()
. - I thought about doing a
log_by_lua
block, but cosockets apis are disabled. https://github.com/openresty/lua-nginx-module#log_by_lua