# Proxying to 2 backends with a if

**URL:** <https://www.ruby-forum.com/t/proxying-to-2-backends-with-a-if/201941>\
**Category:** NGINX\
**Created:** [January 18, 2011, 12:29pm UTC](https://www.ruby-forum.com/t/proxying-to-2-backends-with-a-if/201941 "2011-01-18T12:29:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [January 18, 2011, 12:29pm UTC](https://www.ruby-forum.com/t/proxying-to-2-backends-with-a-if/201941/1 "2011-01-18T12:29:25Z")

</div>

Hi,

Not sure if the mailing list is more popular than the forums, so I ask  
here  
to…  
I setup two servers, each proxying to a different backend, one http and  
one  
fcgi, and it mostly worked.  
Now, I am trying to setup one server that would proxy to the two  
different  
backends based on the presence of args or a header…  
So I merged both configurations, but I have some issues like many  
configuration  
parameters do not work inside a ‘if’.  
I moved most outside the if, but I am not sure of the effects.  
And the headers don’t seem to be proxied to the fcgi backend…  
Could some knowledgeable people offer some advice on how to fix my  
configuration  
file?  
You can see the trimed configuration here:

> **[Proxying to 2 backends with a if...](https://forum.nginx.org/read.php?11,166892)**
>
> Hi, I setup two servers, each proxying to a different backend, one http and one fcgi, and it mostly worked. Now, I am trying to setup one server that would proxy to the two different backends based on the presence of args or a header... So I merged...

Basicaly I want to: “if (args or header) then pass to fcgi, else pass to  
http  
backend”

Thanks,  
JD
