# Proxy handler to multiple servers for single request

**URL:** <https://www.ruby-forum.com/t/proxy-handler-to-multiple-servers-for-single-request/213526>\
**Category:** NGINX\
**Created:** [November 4, 2011, 12:01pm UTC](https://www.ruby-forum.com/t/proxy-handler-to-multiple-servers-for-single-request/213526 "2011-11-04T12:01:45Z")\
**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:** [November 4, 2011, 12:01pm UTC](https://www.ruby-forum.com/t/proxy-handler-to-multiple-servers-for-single-request/213526/1 "2011-11-04T12:01:45Z")

</div>

I have requirement where proxy handler needs to talk to multiple server  
before sending request to actual server where it gets processed. For  
example proxy handler receives user request, talks to virus scanner to  
see user data contain any virus or not then only forward to actual  
server. Here virus scanner may be another server or a thread part of  
nginx. My doubts are

1. When I went through proxy module, ngx\_http\_proxy\_create\_request is  
the callback responsible to prepare request to send to another server.  
As per understanding, I need to call here virus scanner before sending  
request. Is it correct? Or is there any other place I can do this work?  
In this function if I call virus scanner API’s, how will the request  
forwarded the server which serves request?

2. How to make it asynchronous with out effecting nginx’s performance.

–  
Thanks

Posted at Nginx Forum:

> **[Proxy handler to multiple servers for single request.](https://forum.nginx.org/read.php?2,217811,217811)**
>
> I have requirement where proxy handler needs to talk to multiple server before sending request to actual server where it gets processed. For example proxy handler receives user request, talks to virus scanner to see user data contain any virus or not...

---

<div class="post-metadata">

**Author:** ![forum\_id](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/838e76/32.png) [@forum\_id](https://www.ruby-forum.com/u/forum_id)\
**Post date:** [November 4, 2011, 12:58pm UTC](https://www.ruby-forum.com/t/proxy-handler-to-multiple-servers-for-single-request/213526/2 "2011-11-04T12:58:38Z")

</div>

I am trying to develop some thing similar to mod\_clamav for apache. This  
module scans only responses, I need to scan even requests.

Posted at Nginx Forum:

> **[Re: Proxy handler to multiple servers for single request.](https://forum.nginx.org/read.php?2,217811,217814#msg-217814)**
>
> I have requirement where proxy handler needs to talk to multiple server before sending request to actual server where it gets processed. For example proxy handler receives user request, talks to virus scanner to see user data contain any virus or not...
