httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
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 /xyz.mn.op.st/ http://xyz.mn.op.st/ 
> ProxyPassReverse /xyz.mn.op.st/ http://xyz.mn.op.st/ 
> 
> I can access device xyz.mn.op.st by going to
> http://myhost.edu/xyz.mn.op.st/, 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 .foo.com, 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.

Regards,

Brian.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message