How can I duplicate (or create and send) a request with the nginx web server. I can not use post_actionbecause it is a synchronous method. In addition, I compiled nginx with Lua support, but if I try to use http.requestwith ngx.thread.spawnor coroutine, I find that the request was executed synchronously. How to solve this?
location ~ /(.*)\.jpg {
proxy_pass http://127.0.0.1:6081;
access_by_lua_file '/var/m-system/stats.lua';
}
Lua script (c coroutine):
local http = require "socket.http"
local co = coroutine.create(function()
http.request("http://10.10.1.1:81/log?action=view")
end
)
coroutine.resume(co)
source
share