Proxy request to all backend servers

Hello,

Given my nginx (as a http reverse proxy) has two backend servers, one
is 192.168.1.1, another is 192.168.1.2
When a request income, I want to pass it to the both application
servers.
Can I setup nginx doing it? and how?

Thanks.

You should look at HttpLuaModule:

Example:
– construct the requests table
local reqs = {}
table.insert(reqs, { “/mysql” })
table.insert(reqs, { “/postgres” })
table.insert(reqs, { “/redis” })
table.insert(reqs, { “/memcached” })

-- issue all the requests at once and wait until they all return
local resps = { ngx.location.capture_multi(reqs) }

-- loop over the responses table
for i, resp in ipairs(resps) do
    -- process the response table "resp"
end

Posted at Nginx Forum: