httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacobo García <>
Subject [users@httpd] Apache + Mod_Rewrite + IP Auth + Mongrels
Date Wed, 20 Jun 2007 17:02:12 GMT

I'm working on a setup with the following structure, all the software is
in the same server.

Apache 2 server with mod_proxy, mod_rewrite and some others.

An apacher conf file with 3 Virtualhosts of different domains for a
rails app.

Each virtual hosts has some rules to redirect petitions to a mongrel
cluster (which is an http webserver oriented for rails app)

I need to implement some auth based on ips, all 3 virtualhosts needs the
same ips for auth. 

My problem cames when managing the ip list, there is a lot of editing
when adding new ips, so i am looking for a way to centralize the list of
ips and then use this list in all checks. I've been looking for using
RewriteMap or something like this, but I have a little experience with

Each virtualhost file is almost identical except for some path names. 

Here is the config of one virtual host.

<VirtualHost *:80>
DocumentRoot /var/www/theapp/current/public/default

<Directory "/var/www/theapp/current/public/default">

Options FollowSymLinks  
AllowOverride None
Order Deny,Allow
Deny from all

Allow from x.x.x.x
Allow from x.x.x.x
Allow from x.x.x.x
#Lot of allow rules for some ips

RewriteEngine On
# Rewrite index to check for static
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]  
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ 
RewriteRule ^/$ /index.html [QSA]

# Rewrite to check for Rails cached page
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]  
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ 
RewriteRule ^([^.]+)$ $1.html [QSA]

# Peticiones de contenido din 
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ [OR]  
RewriteCond %{REMOTE_ADDR} ^x.x.x.x$ 
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
ServerSignature On


<Proxy balancer://mongrel_cluster>
BalancerMember http://flamingo:21000
BalancerMember http://flamingo:21001
BalancerMember http://flamingo:21002
BalancerMember http://flamingo:21003
BalancerMember http://flamingo:21004
BalancerMember http://flamingo:21005

Thanks for your time.

Jacobo García López de Araujo.

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