httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ricardo13 <>
Subject [users@httpd] Mod_rewrite and mod_proxy_balancer
Date Wed, 20 May 2009 18:13:47 GMT

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]


<Proxy balancer://class1>

<Proxy balancer://class2>

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");

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

Thank you

View this message in context:
Sent from the Apache HTTP Server - Users mailing list archive at

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message