Answer the question
In order to leave comments, you need to log in
How to make an asynchronous GET Request in nginx?
Good day. Can't send asynchronous request to nginx, using post_action blocks the thread, however when trying to call http.request via ngx.thread.spawn or coroutine still doesn't happen asynchronously:
location ~ /(.*)\.jpg {
proxy_pass http://127.0.0.1:6081;
access_by_lua_file '/var/m-system/stats.lua';
}
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)
<?php
sleep(10);
echo 'hello';
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question