]> granicus.if.org Git - apache/commitdiff
add no-proxy envvar for mod_proxy
authorEric Covener <covener@apache.org>
Wed, 1 Feb 2017 22:33:10 +0000 (22:33 +0000)
committerEric Covener <covener@apache.org>
Wed, 1 Feb 2017 22:33:10 +0000 (22:33 +0000)
replacement for ProxyPass /path ! when ProxyPass is in
location context.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1781328 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_proxy.xml
modules/proxy/mod_proxy.c

diff --git a/CHANGES b/CHANGES
index ac9e7ac7a06e670d0168a8de113b33ebf8cf5b35..a09fdfdc0df5ea9359eda7127916d8fcd93022ab 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_proxy: Allow the per-request environment variable "no-proxy" to
+     be used as an alternative to ProxyPass /path !. This is primarily
+     to set exceptions for ProxyPass specified in <Location> context.
+     Use SetEnvIf, not SetEnv.
+
   *) mod_http2: fix for crash when running out of memory.
      [Robert Swiecki <robert@swiecki.net>, Stefan Eissing]
      
index 30870b8d065174e29aacbccb74d0fb52dd653bb7..76aed30ae7c808f757e52b8a14b40a3ac6f38566 100644 (file)
@@ -398,6 +398,12 @@ ProxyPass "/examples" "http://backend.example.com/examples" timeout=10
 &lt;/Location&gt;
         </highlight>
 
+      <p> The "no-proxy" environment variable can be set to disable 
+      <module>mod_proxy</module> processing the current request.
+      This variable should be set with <directive module="mod_setenvif"
+      >SetEnvIf</directive>, as <directive module="mod_env">SetEnv</directive>
+      is not evaluated early enough.</p>
+
     </section> <!-- /envsettings -->
 
     <section id="request-bodies"><title>Request Bodies</title>
@@ -974,7 +980,14 @@ ProxyPass "/mirror/foo"   "http://backend.example.com"
       specific location will take precedence.</p>
 
       <p>For the same reasons, exclusions must come <em>before</em> the
-      general <directive>ProxyPass</directive> directives.</p>
+      general <directive>ProxyPass</directive> directives. The "no-proxy"
+      environment variable is an alternative to exclusions, and is the only
+      way to configure an exclusion of a <directive>ProxyPass</directive>
+      directive in <directive module="core">Location</directive> context. 
+      This variable should be set with <directive module="mod_setenvif"
+      >SetEnvIf</directive>, as <directive module="mod_env">SetEnv</directive>
+      is not evaluated early enough.
+      </p>
 
     </note> <!-- /ordering_proxypass -->
 
index ceb2c397391e32c8234ec762c4c8962fb1ec3169..8004650e6c89ff2c98287d5e0983c5d6bad33e05 100644 (file)
@@ -781,6 +781,10 @@ static int proxy_trans(request_rec *r)
         || !r->uri || r->uri[0] != '/') {
         return DECLINED;
     }
+   
+    if (apr_table_get(r->subprocess_env, "no-proxy")) { 
+        return DECLINED;
+    }
 
     /* XXX: since r->uri has been manipulated already we're not really
      * compliant with RFC1945 at this point.  But this probably isn't