Re: Mod_rewrite and mod_proxy_balancer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Anyone ???

Or my English isn't good ??

Ricardo

On Wed, May 20, 2009 at 3:13 PM, ricardo13 <ricardoogrande@xxxxxxxxx> wrote:

Hi all,

I have a web cluster with 6 machines. Three machines serve only clients
(class 1) and others serve only normal users (class 2).
I use apache with modules mod_rewrite and mod_proxy_balancer.

Use mod_rewrite to classify (between class1 and class2) incoming requests
and mod_proxy_balancer forward request to the cluster (class1 or class2).

Now, When I type in browser, for example "http://localhost/1", the cluster A
serve my request and when I type "http://localhost/2", the cluster B serve
my request.

Now, I would like to know how I drop a request when come with other type
user ?? For example, "http://localhost/3"

I tried this, but doesn't work.

My httpd.conf:

<IfModule rewrite_module>
       RewriteEngine on
       RewriteLog /usr/local/apache2/logs/rewrite_log
       RewriteLogLevel 5

       RewriteLock /usr/local/apache2/logs/file.lock
       RewriteMap prgmap prg:/usr/local/apache2/admControl

       RewriteCond ${prgmap:$1} ^/bad_url$
       RewriteRule /bad_url - [F]
       RewriteRule ^/(.*) balancer:/${prgmap:$1} [P]

</IfModule>

<Proxy balancer://class1>
       BalancerMember http://192.168.1.11
       BalancerMember http://192.168.1.12
       BalancerMember http://192.168.1.13
</Proxy>

<Proxy balancer://class2>
       BalancerMember http://192.168.1.14
       BalancerMember http://192.168.1.15
       BalancerMember http://192.168.1.16
</Proxy>

My admControl:
#include <stdio.h>
#include <stdlib.h>

int main(int argc,char *argv[]) {

 char input;
 int  id;

 while(1) {
  fscanf(stdin, "%d", &id);

  switch(id) {
    case 1: fprintf(stdout, "/class1"); break;
    case 2: fprintf(stdout, "/class2"); break;
    case default: fprintf(stdout, "/bad_url"); break;
  }
  fprintf(stdout, "\n");
  fflush(stdout);
 }
 return EXIT_SUCCESS;
}

Remember, How I drop a request from "http:localhost/3" ???

Thank you
Ricardo



--
View this message in context: http://www.nabble.com/Mod_rewrite-and-mod_proxy_balancer-tp23640723p23640723.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




--
Muito Obrigado

Ricardo

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux