httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <>
Subject [users@httpd] Re: mod_proxy with regexps
Date Wed, 24 Aug 2005 12:44:48 GMT
On Tue, Aug 23, 2005 at 10:11:20AM -0700, Andrew Musselman wrote:
> Hi, I am trying to set up a proxy to allow access to other devices on
> the network.
> These lines work great:
> ProxyPass / 
> ProxyPassReverse / 
> I can access device by going to
>, but I have about a hundred different
> addresses I would like to access through the proxy.
> Can some regexp guru point me in the right direction?  Or is there some
> other solution?

mod_rewrite. (If the only tool you have is a hammer then everything looks
like a nail :-)

To start with try something like:

RewriteEngine on
RewriteRule /([^/]+)(.*)$ http://$1$2 [P]

This will do nothing *except* proxy /xxx/ to http://xxx/ for any xxx, and
it's horribly insecure since it will happily proxy to anywhere. So you need
to tighten this up; if you can match all the domains by a regexp or a few,
e.g. if they all end in, then do that:

RewriteRule /([^/]+\.foo\.com)(/?.*)$ http://$1$2 [P]

Otherwise, you may need to use a RewriteMap lookup in a .txt or .db database
to allow the requests.



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