1

We have a Symfony2 application which is in heavy development and have just signed our first production client.

We want to temporarily put this client on another cluster that is stable while we continue heavy development on our current cluster. We want this whole situation to remain invisible to the client however.

So, I'd like to selectively forward requests from this client's machine using their specific request header authorization (preferred) or their IP address (if header isn't possible) from our primary www webserver to the webserver of our stable cluster.

I'm looking at mod_proxy, would this be the best tool to achieve this? Anything else? I can do it in the application if necessary but this would add a bit of unwanted overhead to each request. We're set up on AWS if that provides any additional tools that I'm unaware of.

Thanks a bunch!

2
  • Sounds risky to rely on their requests being forwarded through a development web server. Wouldn't it make more sense to have the stable web server be the one, which the client connect to? You could still forward some requests from the stable server to the development server, if you absolutely have to.
    – kasperd
    Aug 10, 2014 at 23:50
  • Certainly a fair comment thank you. Our particular situation is kind of a long story but the server handling the routing is a production server and should remain 99.9% stable....the reason I don't want to use the application it's hosting is that it's going to change dramatically and I don't want to force changes on a third party.
    – Pez
    Aug 11, 2014 at 19:39

1 Answer 1

1

Since you want to do the forward selectively, you need both mod_proxy and mod_rewrite, as mod_proxy by itself would only proxy by the URL context

You could either proxy based on remote IP:

RewriteCond %{REMOTE_ADDR} ^12.34.56.78$
RewriteRule ^(.*)$  http://cluster/$1  [P]

or based on login (asuming basic authentication):

RewriteCond %{REMOTE_USER} ^username$
RewriteRule ^(.*)$  http://cluster/$1  [P]

There is also the %{HTTP:header_name} in case it is a custom header:

RewriteCond %{HTTP:my_custom_header_name} ^my_custom_header_value$
RewriteRule ^(.*)$  http://cluster/$1  [P]
2
  • Thank you works great. Some minor issues, you start your conditions with a $ instead of a %, so what I used was more like: RewriteCond %{HTTP:my_custom_header_name} ^my_custom_header_value$ RewriteRule ^(.*)$ cluster/$1 [P,L]
    – Pez
    Aug 11, 2014 at 17:41
  • True, my bad. I'm fixing it.
    – NuTTyX
    Aug 11, 2014 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .