From: Ian Holsman Date: Tue, 29 Jan 2002 19:00:45 +0000 (+0000) Subject: configuration change. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d71dbcbc0cdbf35a04cde1174e7e6c2f5881ccac;p=apache configuration change. allow a '!' directive to stop proxying these requests eg. ProxyPass /services/images/ ! ProxyPass /services/ http://service-machine/services/ which will stop requests to /services/images/ from being proxied Submitted by: Jukka Pihl Reviewed by: Ian Holsman, Graham Legget, Chuck Murcko git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93086 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 5894466dc4..0f26047225 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ Changes with Apache 2.0.31-dev + *) New Directive Option for ProxyPass. It now can block a location + from being proxied [Jukka Pihl ] *) Don't let the default handler try to serve a raw directory. At best you get gibberish. Much worse things can happen depending diff --git a/docs/manual/mod/mod_proxy.html b/docs/manual/mod/mod_proxy.html index df5e1c8d81..616c49917a 100644 --- a/docs/manual/mod/mod_proxy.html +++ b/docs/manual/mod/mod_proxy.html @@ -328,9 +328,10 @@ by another forward proxy. Syntax: ProxyPass path url
-or: ProxyPass url when placed in a <location> directive (Apache 2.0 only) -
+>Syntax: ProxyPass path url
+or: ProxyPass url when placed in a <location> directive (Apache 2.0 only)
+or: ProxyPass path ! to exclude a path from being proxied. +
http://wibble.org/mirror/foo/bar> to be internally converted into a proxy request to <http://foo.com/bar>. - - +

+The ! directive is usefull in situations where you don't want to reverse-proxy +a subdirectory. eg. +

+        ProxyPass /mirror/foo http://foo.com
+        ProxyPass /mirror/foo/i !
+
+will proxy all requests to /mirror/foo to foo.com EXCEPT requests made to /mirror/foo/i +


ProxyPassReverse directive

diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index b82657e128..9bb07a859a 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -188,6 +188,10 @@ static int proxy_trans(request_rec *r) len = alias_match(r->uri, ent[i].fake); if (len > 0) { + if ((ent[i].real[0] == '!' ) & ( ent[i].real[1] == 0 )) { + return DECLINED; + } + r->filename = apr_pstrcat(r->pool, "proxy:", ent[i].real, (r->uri + len ), NULL); r->handler = "proxy-server";