Passing response from upstream server to another upstream server

MAGNIEN, Thierry thierry.magnien at
Wed Nov 13 16:30:58 UTC 2013

Hi Arnaud,

Thanks for your response but my goal is to have only one Nginx server, not chaining them.

>From what I've seen, I think I should be able to achieve this using proxy + lua module, and I'll write my own module using subrequests if performance is too low.


-----Message d'origine-----
De : Arnaud GRANAL [mailto:serphen at] 
Envoyé : mercredi 13 novembre 2013 17:24
À : nginx-devel at
Cc : MAGNIEN, Thierry
Objet : Re: Passing response from upstream server to another upstream server

Hi Thierry,

This is the nginx-devel mailing-list (for development and commits), I
guess you will have better luck on nginx user list

nginx can be an upstream of another nginx (as reverse proxy).
This means that you can chain nginx [A]->nginx [B]->nginx [C]->nginx
[D] as much as you want. However the more layers you add, the more
risks you have to break the chain (in reality, you end up with tons of
opened sockets, issues with TIME_WAIT, tuning persistent connections
between instances, etc..).

Whenever possible, try to keep nginx [A] -> nginx [D] because this
makes debugging and monitoring very simple.
If you are trying to reach an internal network, you can for example
use a GRE tunnel if your problem is that [A] can't talk directly with


On Tue, Nov 12, 2013 at 4:04 PM, MAGNIEN, Thierry
<thierry.magnien at> wrote:
> Hi,
> I would like to achieve something like this:
> - Nginx receives request from client
> - Nginx forwards request to an upstream server and reads response
> - Nginx sends this  response to another upstream server (it will perform some content modification)
> - Nginx gets final response and sends it over to client
> Is there a way to achieve this by using existing modules and an adequate configuration, or do I need to write my own "double upstream" module ?
> Thanks a lot,
> Thierry
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at

More information about the nginx-devel mailing list