# Proxy request to all backend servers

**URL:** <https://www.ruby-forum.com/t/proxy-request-to-all-backend-servers/210703>\
**Category:** NGINX\
**Created:** [August 15, 2011, 11:50am UTC](https://www.ruby-forum.com/t/proxy-request-to-all-backend-servers/210703 "2011-08-15T11:50:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [August 15, 2011, 11:50am UTC](https://www.ruby-forum.com/t/proxy-request-to-all-backend-servers/210703/1 "2011-08-15T11:50:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Feng\_He](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/ba8739/32.png) [@Feng\_He](https://www.ruby-forum.com/u/Feng_He)\
**Post date:** [August 26, 2011, 10:10am UTC](https://www.ruby-forum.com/t/proxy-request-to-all-backend-servers/210703/2 "2011-08-26T10:10:51Z")

</div>

You should look at HttpLuaModule:

> **[Lua | NGINX](https://www.nginx.com/resources/wiki/modules/lua/)**
>
> The Lua module embeds Lua into NGINX and by leveraging NGINX's subrequests, allows the integration of Lua threads into the NGINX event model.

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:

> **[Re: proxy request to all backend servers](https://forum.nginx.org/read.php?2,213808,214322#msg-214322)**
>
> 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. \_\_\_\_\_\_\_\_
