nginx-selective-cache-purge-module
nginx-selective-cache-purge-module copied to clipboard
Subrequest for purge never returns when called from lua
I'm using the following setup
location ~ /purge(.*) {
selective_cache_purge_query "$1";
}
location ~ /mpurge {
content_by_lua_block {
local res = ngx.location.capture("/purge/*")
ngx.print(res.status)
ngx.print(res.body)
return
}
}
It just hangs. I can only guess the module does not close the connection.
What happens if you call the /purge
directly?
And using a Lua client but outside Nginx?
Just trying to figure out if the problem is on module or some combination of module, Lua and Nginx.
I get 400 status with empty body for ngx.location.capture("/purge"). If I call it from browser - it just works as expected. I was able to make it work using lua-resty-http from withing nginx. So basically it hangs when some content is returned by the module. It might have something to do with buffering as well
It might have something to do with buffering as well https://github.com/openresty/lua-nginx-module/issues/415