[users@httpd] Re: mod_proxy with regexps

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

 



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



[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