Proxy handler to multiple servers for single request

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.


Posted at Nginx Forum:

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: