Directed Load Balance Help.

David Moffett dmoffett at vizzvox.com
Tue Jul 31 21:15:48 MSD 2007


Our project needs to redirect users to certain back end servers based  
on the url.  For example if the url contains a string '00um' that  
should redirect the user to a certain mongrel cluster on a particular  
machine.

I have tried to use something like the following:


   upstream mongrel {
         00um 127.0.0.1:8000;
         01um 127.0.0.1:8001;
         02um 127.0.0.1:8002;
         set $server_key = "";
         if( $request_uri ~* "id=^.*([0-9][0-9][a-z][a-z])$" ) {
                 set $server_key $1
         }
         hash $server_key
     }

As you may guess the above configure is a concept and probably does  
not work.  I have tried some variations on this theme with out much  
success.

First question is will something like this work at all or does the  
hash actually just index into the upstream table or is the upstream  
table a hash that can be looked up by key?

Second question is there a method to do what I am asking if the above  
solution is not even close.  :-)

Thank you,
David





More information about the nginx mailing list