]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy: unfail mixed ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch>.
authorYann Ylavic <ylavic@apache.org>
Tue, 30 Jun 2020 12:15:41 +0000 (12:15 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 30 Jun 2020 12:15:41 +0000 (12:15 +0000)
It is not a failure in current 2.4.x, so to ease backport and to avoid compat
breakage simply warn about the second directive being ignored.

This commit can be reverted in trunk if we want next versions to fail in this
case.

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

docs/log-message-tags/next-number
modules/proxy/mod_proxy.c

index 5dae555dfbfe40448b4bc1769a858c62e00e9d79..fde32dc6d61a8ac3742bc85798807781911c1441 100644 (file)
@@ -1 +1 @@
-10249
+10251
index d730a6d0477bbd6a623f8b0fc0b2a6d95bbfa06b..e40d8f8c87bd91b40bc5ec431655562ff06743ca 100644 (file)
@@ -2185,10 +2185,21 @@ static const char *
             PROXY_COPY_CONF_PARAMS(worker, conf);
         }
         else if ((use_regex != 0) ^ (worker->s->is_name_matchable != 0)) {
-            return apr_pstrcat(cmd->temp_pool, "ProxyPass/<Proxy> and "
-                               "ProxyPassMatch/<ProxyMatch> can't be used "
-                               "together with the same worker name ",
-                               "(", worker->s->name, ")", NULL);
+            ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(10249)
+                         "ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch> "
+                         "can't be used altogether with the same worker "
+                         "name (%s); ignoring ProxyPass%s",
+                         worker->s->name, use_regex ? "Match" : "");
+            /* Rollback new alias */
+            if (cmd->path) {
+                dconf->alias = NULL;
+                dconf->alias_set = 0;
+            }
+            else {
+                memset(new, 0, sizeof(*new));
+                apr_array_pop(conf->aliases);
+            }
+            return NULL;
         }
         else {
             reuse = 1;
@@ -2955,10 +2966,15 @@ static const char *proxysection(cmd_parms *cmd, void *mconfig, const char *arg)
                                        " ", err, NULL);
             }
             else if ((use_regex != 0) ^ (worker->s->is_name_matchable != 0)) {
-                return apr_pstrcat(cmd->temp_pool, "ProxyPass/<Proxy> and "
-                                   "ProxyPassMatch/<ProxyMatch> can't be used "
-                                   "altogether with the same worker name ",
-                                   "(", worker->s->name, ")", NULL);
+                ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(10250)
+                             "ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch> "
+                             "can't be used altogether with the same worker "
+                             "name (%s); ignoring <Proxy%s>",
+                             worker->s->name, use_regex ? "Match" : "");
+                /* Rollback new section */
+                ((void **)sconf->sec_proxy->elts)[sconf->sec_proxy->nelts - 1] = NULL;
+                apr_array_pop(sconf->sec_proxy);
+                goto cleanup;
             }
             if (!worker->section_config) {
                 worker->section_config = new_dir_conf;
@@ -2989,6 +3005,7 @@ static const char *proxysection(cmd_parms *cmd, void *mconfig, const char *arg)
         }
     }
 
+cleanup:
     cmd->path = old_path;
     cmd->override = old_overrides;