1. cosocket 可以用在 access_by_lua 和 content_by_lua 阶段
2. body_by_lua* 可以放在 http, server, location, location if 这几个阶段
https://github.com/openresty/lua-nginx-module#ngxsockettcp
https://github.com/openresty/lua-nginx-module#body_filter_by_lua
On Tuesday, July 11, 2017 at 2:18:38 PM UTC+8, han liu wrote:
我现在有这样的一个场景:
需要在获取到响应头的时使用redis进行存储(lua-resty-redis模块)。但是现在遇到的问题是这样的:
在access_by_lua*或者content_by_lua*中无法使用ngx.socket.tcp,所以无法建立与redis的链接。
我查阅春哥文档后发现可以用在body_by_lua*中,但是由于这个所能放在的context只能在location中,线上nginx的location有上百个,所以这种的方式是不现实的。我希望可以放到http的context中。
针对于这两点,大家有没有什么好的办法可以解决?