Commit 77ebb516 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r1781324, r1781328 from trunk:

revert r1780909 and r1773397 ProxyPass ! perdir

r1773397 had a regression and the whole thing is fishy
to shoehorn the current ProxyPass ! syntax into.



add no-proxy envvar for mod_proxy

replacement for ProxyPass /path ! when ProxyPass is in
location context.


Submitted by: covener
Reviewed by: covener, jim, jorton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1782332 13f79535-47bb-0310-9956-ffa450edef68
parent 90d28fb7
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -15,6 +15,11 @@ Changes with Apache 2.4.26
     streams are finished normally before the final GOAWAY is sent. 
     [Stefan Eissing, <slavko gmail.com>]

  *) 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: fixes PR60599, sending proper response for conditional requests
     answered by mod_cache. [Jeff Wheelhouse, Stefan Eissing]
     
+0 −6
Original line number Diff line number Diff line
@@ -127,12 +127,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) mod_proxy: replace broken hunting for proxypass exceptions to location-based 
                proxypass directives with "no-proxy" envvar. Fixes a regression in 2.4.25.
     trunk patch: http://svn.apache.org/r1781324
                  http://svn.apache.org/r1781328
     2.4.x patch: http://people.apache.org/~covener/patches/httpd-2.4.x-noproxy.diff
     +1 covener, jim, jorton


PATCHES PROPOSED TO BACKPORT FROM TRUNK:
+14 −1
Original line number Diff line number Diff line
@@ -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>
@@ -959,7 +965,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 -->

+8 −15
Original line number Diff line number Diff line
@@ -765,35 +765,28 @@ static int proxy_trans(request_rec *r)
        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
     * an issue because this is a hybrid proxy/origin server.
     */

    dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
    conf = (proxy_server_conf *) ap_get_module_config(r->server->module_config,
                                                      &proxy_module);

    /* short way - this location is reverse proxied? */
    if (dconf->alias) {
        int rv = ap_proxy_trans_match(r, dconf->alias, dconf);
        if (OK == rv) { 
            /* Got a hit. Need to make sure it's not explicitly declined */
            if (conf->aliases->nelts) {
                ent = (struct proxy_alias *) conf->aliases->elts;
                for (i = 0; i < conf->aliases->nelts; i++) {
                    int rv = ap_proxy_trans_match(r, &ent[i], dconf);
                    if (DECLINED == rv) { 
                        return DECLINED;
                    }
                }
            }
            return OK; 
        }
        if (DONE != rv) {
            return rv;
        }
    }

    conf = (proxy_server_conf *) ap_get_module_config(r->server->module_config,
                                                      &proxy_module);

    /* long way - walk the list of aliases, find a match */
    if (conf->aliases->nelts) {
        ent = (struct proxy_alias *) conf->aliases->elts;