From 37c5465898e87bd6bcc0fbc12db1aeba49d45997 Mon Sep 17 00:00:00 2001 From: Eric Covener Date: Wed, 1 Feb 2017 22:33:10 +0000 Subject: [PATCH] add no-proxy envvar for mod_proxy 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 | 5 +++++ docs/manual/mod/mod_proxy.xml | 15 ++++++++++++++- modules/proxy/mod_proxy.c | 4 ++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index ac9e7ac7a0..a09fdfdc0d 100644 --- 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 context. + Use SetEnvIf, not SetEnv. + *) mod_http2: fix for crash when running out of memory. [Robert Swiecki , Stefan Eissing] diff --git a/docs/manual/mod/mod_proxy.xml b/docs/manual/mod/mod_proxy.xml index 30870b8d06..76aed30ae7 100644 --- a/docs/manual/mod/mod_proxy.xml +++ b/docs/manual/mod/mod_proxy.xml @@ -398,6 +398,12 @@ ProxyPass "/examples" "http://backend.example.com/examples" timeout=10 </Location> +

The "no-proxy" environment variable can be set to disable + mod_proxy processing the current request. + This variable should be set with SetEnvIf, as SetEnv + is not evaluated early enough.

+
Request Bodies @@ -974,7 +980,14 @@ ProxyPass "/mirror/foo" "http://backend.example.com" specific location will take precedence.

For the same reasons, exclusions must come before the - general ProxyPass directives.

+ general ProxyPass directives. The "no-proxy" + environment variable is an alternative to exclusions, and is the only + way to configure an exclusion of a ProxyPass + directive in Location context. + This variable should be set with SetEnvIf, as SetEnv + is not evaluated early enough. +

diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index ceb2c39739..8004650e6c 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -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 -- 2.50.1