You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Andrew Musselman <An...@cwu.EDU> on 2005/08/23 19:11:20 UTC
[users@httpd] mod_proxy with regexps
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?
Thank you for your time.
Best,
Andrew
Andrew Musselman
andrew@cwu.edu
---------------------------------------------------------------------
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
[users@httpd] Re: mod_proxy with regexps
Posted by Brian Candler <B....@pobox.com>.
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