Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say my current website is running on machine A. I plan to launch new website on Machine B. Now I want to make this new website live to users belonging to some particular location only (IP based). This would allow us to test new site without disturbing existing setup and before making it open to all.

What kind of setup (servers/reverse proxy/IP database etc) would be recommended? Any problem with this approach (apart from redirect delay and possible SEO problems)?

Thanks for your help.

share|improve this question
Are these servers sharing a web-facing IP address? – Joel E Salas Jul 6 '12 at 20:56
@Joel: both servers have different IP and hosted on different locations. So probably some kind of DNS balancing would be required as well. – ucker Jul 6 '12 at 20:58
Do you run your own DNS servers? – Joel E Salas Jul 6 '12 at 21:12
@Joel: No. We do not run our own DNS servers. – ucker Jul 6 '12 at 21:16
Do you have load balancers in place? – mrdenny Jul 7 '12 at 3:08
up vote 0 down vote accepted

Ok if you want a really simple solution and the list of IP users is short just use .htaccess and apache RewriteEngine on Machine A.

For example add this to your .htaccess:

RewriteCond %{REMOTE_ADDR} ^(192\.168\.0\.12)$  [OR]
RewriteCond %{REMOTE_ADDR} ^(192\.168\.0\.13)$  
RewriteRule ^(.*)$$1 [P]

If not just check the documentation for apache mod_proxy.

If that's not enough you can use solutions like varnish, nginx proxy, HAproxy, but you will need to reconfigure apache on machine A and add complexity to your solution.

share|improve this answer
this rewrite should be 302 redirect, right? – ucker Jul 7 '12 at 4:56

There's no shortage of options here. Pretty much every webserver I've played with has the ability to examine and act differently depending on the client IP address, and once you've got that functionality you can just route the request to different places based on the IP address rules you setup.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.