|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
mod_rewrite - Redirect to internal server
Hi all I'm working with an environment that has a load balancer that splits the traffic between two servers that are behind the load balancer, the load balancer I don't have access to change. Now I want to force traffic from one server to the other using a htaccess file and a rewrite condition
I have this so far but the last line I just can figure out what to do. As both servers are vhosts using a direct URL is not possible RewriteEngine on rewritecond %{SERVER_ADDR} ^100\.100\.100\.8 RewriteRule (.*) 100\.100\.100\.7 /$1 [R=301,L] // this line |
|
#2
|
|||
|
|||
|
Without some way for the load balancer to detect that it should send traffic to a particular server, the best you can do is
RewriteEngine On RewriteRule (.*) http://www.example.com/$1 [L] This should be on the web server you want to not serve pages, and www.example.com is the public name for your site (your LB). The problem is that a client can see this, ask www.example.com for the page again, be _again_ sent to the same server, only to be redirected, looping until the LB chooses to send it to the other server. You really just need to be able to configure the LB to drop that server out of the pool. Last edited by djlarsu : June 18th, 2009 at 01:39 PM. Reason: correct rule |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > mod_rewrite - Redirect to internal server |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|