diff -Naurp httpd-2.4.x.orig/docs/manual/mod/mod_proxy.xml httpd-2.4.x.new/docs/manual/mod/mod_proxy.xml
--- httpd-2.4.x.orig/docs/manual/mod/mod_proxy.xml 2014-11-03 14:51:41.961619210 +0100
+++ httpd-2.4.x.new/docs/manual/mod/mod_proxy.xml 2014-11-03 15:52:33.083979540 +0100
@@ -1517,6 +1517,41 @@ will rewrite a cookie with backend path
+This directive is equivalent to
+
+As a special case, if public-path is set to
+In example, the following statement maps the path prefix (where
+ This directive, together with the interpolate argument to
!
, the
+cookie path is left unchanged: this can be used to disable matching by the
+subsequent varname
for the string ${varname}
in configuration directives (if the interpolate option is set).internal.example.com
so that they target the appropriate
directory on the local server. Similarly, the
-
It is important to note, however, that links inside the documents will not be rewritten. So any absolute diff -Naurp httpd-2.4.x.orig/modules/proxy/mod_proxy.c httpd-2.4.x.new/modules/proxy/mod_proxy.c --- httpd-2.4.x.orig/modules/proxy/mod_proxy.c 2014-11-03 14:51:46.213656406 +0100 +++ httpd-2.4.x.new/modules/proxy/mod_proxy.c 2014-11-03 14:52:54.436253123 +0100 @@ -1723,10 +1723,26 @@ static const char* cookie_path(cmd_parms new = apr_array_push(conf->cookie_paths); new->fake = f; new->real = r; + new->regex = NULL; new->flags = interp ? PROXYPASS_INTERPOLATE : 0; return NULL; } +static const char* cookie_path_regex(cmd_parms *cmd, void *dconf, const char *f, + const char *r, const char *interp) +{ + proxy_dir_conf *conf = dconf; + struct proxy_alias *new; + + new = apr_array_push(conf->cookie_paths); + new->fake = f; + new->real = r; + new->flags = interp ? PROXYPASS_INTERPOLATE : 0; + new->regex = ap_pregcomp(cmd->pool, f, AP_REG_EXTENDED); + if (new->regex == NULL) + return "Regular expression could not be compiled."; + return NULL; +} static const char* cookie_domain(cmd_parms *cmd, void *dconf, const char *f, const char *r, const char *interp) { @@ -2401,6 +2417,8 @@ static const command_rec proxy_cmds[] = "a virtual path and a URL for reverse proxy behaviour"), AP_INIT_TAKE23("ProxyPassReverseCookiePath", cookie_path, NULL, RSRC_CONF|ACCESS_CONF, "Path rewrite rule for proxying cookies"), + AP_INIT_TAKE23("ProxyPassReverseCookiePathMatch", cookie_path_regex, NULL, + RSRC_CONF|ACCESS_CONF, "Path rewrite rule for proxying cookies"), AP_INIT_TAKE23("ProxyPassReverseCookieDomain", cookie_domain, NULL, RSRC_CONF|ACCESS_CONF, "Domain rewrite rule for proxying cookies"), AP_INIT_ITERATE("ProxyBlock", set_proxy_exclude, NULL, RSRC_CONF, diff -Naurp httpd-2.4.x.orig/modules/proxy/proxy_util.c httpd-2.4.x.new/modules/proxy/proxy_util.c --- httpd-2.4.x.orig/modules/proxy/proxy_util.c 2014-11-03 14:51:46.371657788 +0100 +++ httpd-2.4.x.new/modules/proxy/proxy_util.c 2014-11-03 14:52:54.437253147 +0100 @@ -971,6 +971,7 @@ PROXY_DECLARE(const char *) ap_proxy_coo const char *pathe = NULL; const char *domaine = NULL; apr_size_t l1, l2, poffs = 0, doffs = 0; + ap_regmatch_t regm[AP_MAX_REG_MATCH]; int i; int ddiff = 0; int pdiff = 0; @@ -997,11 +998,24 @@ PROXY_DECLARE(const char *) ap_proxy_coo ent = (struct proxy_alias *)conf->cookie_paths->elts; } for (i = 0; i < conf->cookie_paths->nelts; i++) { - l2 = strlen(ent[i].fake); - if (l1 >= l2 && strncmp(ent[i].fake, pathp, l2) == 0) { - newpath = ent[i].real; - pdiff = strlen(newpath) - l1; - break; + if (ent[i].regex) { + if (!ap_regexec_len(ent[i].regex, pathp, l1, AP_MAX_REG_MATCH, + regm, 0)) { + if (ent[i].real[0] == '!' && ent[i].real[1] == '\0') + break; + newpath = ap_pregsub(r->pool, ent[i].real, pathp, + AP_MAX_REG_MATCH, regm); + pdiff = strlen(newpath) - l1; + break; + } + } + else { + l2 = strlen(ent[i].fake); + if (l1 >= l2 && strncmp(ent[i].fake, pathp, l2) == 0) { + newpath = ent[i].real; + pdiff = strlen(newpath) - l1; + break; + } } } }