View | Details | Raw Unified | Return to bug 54306
Collapse All | Expand All

(-)httpd-2.4.x.orig/docs/manual/mod/mod_proxy.xml (-4 / +41 lines)
Lines 1517-1522 will rewrite a cookie with backend path Link Here
1517
</directivesynopsis>
1517
</directivesynopsis>
1518
1518
1519
<directivesynopsis>
1519
<directivesynopsis>
1520
<name>ProxyPassReverseCookiePathMatch</name>
1521
<description>Adjusts the Path string in Set-Cookie headers from a reverse-
1522
proxied server using a regular expression</description>
1523
<syntax>ProxyPassReverseCookiePathMatch <var>regex</var>
1524
<var>public-path</var> [<var>interpolate</var>]</syntax>
1525
<contextlist><context>server config</context><context>virtual host</context>
1526
<context>directory</context>
1527
</contextlist>
1528
<usage>
1529
<p>
1530
This directive is equivalent to 
1531
<directive module="mod_proxy">ProxyPassReverseCookiePath</directive>,
1532
but makes use of <glossary ref="regex">regular expressions</glossary>
1533
instead of simple prefix matching. In addition, <var>public-path</var> is
1534
subject to parenthesized matches substitution, thus allowing a dynamic path
1535
mapping.
1536
</p>
1537
<p>
1538
As a special case, if <var>public-path</var> is set to <code>!</code>, the
1539
cookie path is left unchanged: this can be used to disable matching by the
1540
subsequent <directive module="mod_proxy">ProxyPassReverseCookie</directive>/
1541
<directive module="mod_proxy">ProxyPassReverseCookiePath</directive> directives.
1542
</p>
1543
<p>
1544
In example, the following statement maps the path prefix (where
1545
<directive module="mod_proxy">ProxyPassReverseCookie</directive> would have
1546
replaced the full path), keeping the path trailer:
1547
</p>
1548
    <highlight language="config">
1549
      ProxyPassReverseCookiePathMatch  ^/(.*)$  /foo/$1
1550
    </highlight>
1551
</usage>
1552
</directivesynopsis>
1553
1554
<directivesynopsis>
1520
<name>ProxyBlock</name>
1555
<name>ProxyBlock</name>
1521
<description>Words, hosts, or domains that are banned from being
1556
<description>Words, hosts, or domains that are banned from being
1522
proxied</description>
1557
proxied</description>
Lines 1879-1893 header for proxied requests</description Link Here
1879
<usage>
1914
<usage>
1880
    <p>This directive, together with the <var>interpolate</var> argument to
1915
    <p>This directive, together with the <var>interpolate</var> argument to
1881
    <directive>ProxyPass</directive>, <directive>ProxyPassReverse</directive>,
1916
    <directive>ProxyPass</directive>, <directive>ProxyPassReverse</directive>,
1882
    <directive>ProxyPassReverseCookieDomain</directive> and
1917
    <directive>ProxyPassReverseCookieDomain</directive>,
1883
    <directive>ProxyPassReverseCookiePath</directive>
1918
    <directive>ProxyPassReverseCookiePath</directive> and
1919
    <directive>ProxyPassReverseCookiePathMatch</directive>
1884
    enables reverse proxies to be dynamically
1920
    enables reverse proxies to be dynamically
1885
    configured using environment variables, which may be set by
1921
    configured using environment variables, which may be set by
1886
    another module such as <module>mod_rewrite</module>.
1922
    another module such as <module>mod_rewrite</module>.
1887
    It affects the <directive>ProxyPass</directive>,
1923
    It affects the <directive>ProxyPass</directive>,
1888
    <directive>ProxyPassReverse</directive>,
1924
    <directive>ProxyPassReverse</directive>,
1889
    <directive>ProxyPassReverseCookieDomain</directive>, and
1925
    <directive>ProxyPassReverseCookieDomain</directive>,
1890
    <directive>ProxyPassReverseCookiePath</directive> directives,
1926
    <directive>ProxyPassReverseCookiePath</directive> and
1927
    <directive>ProxyPassReverseCookiePathMatch</directive> directives,
1891
    and causes them to substitute the value of an environment
1928
    and causes them to substitute the value of an environment
1892
    variable <code>varname</code> for the string <code>${varname}</code>
1929
    variable <code>varname</code> for the string <code>${varname}</code>
1893
    in configuration directives (if the <var>interpolate</var> option is set).</p>
1930
    in configuration directives (if the <var>interpolate</var> option is set).</p>
(-)httpd-2.4.x.orig/docs/manual/urlmapping.xml (-2 / +4 lines)
Lines 58-63 Link Here
58
<directive module="mod_proxy">ProxyPassReverse</directive>
58
<directive module="mod_proxy">ProxyPassReverse</directive>
59
<directive module="mod_proxy">ProxyPassReverseCookieDomain</directive>
59
<directive module="mod_proxy">ProxyPassReverseCookieDomain</directive>
60
<directive module="mod_proxy">ProxyPassReverseCookiePath</directive>
60
<directive module="mod_proxy">ProxyPassReverseCookiePath</directive>
61
<directive module="mod_proxy">ProxyPassReverseCookiePathMatch</directive>
61
<directive module="mod_alias">Redirect</directive>
62
<directive module="mod_alias">Redirect</directive>
62
<directive module="mod_alias">RedirectMatch</directive>
63
<directive module="mod_alias">RedirectMatch</directive>
63
<directive module="mod_rewrite">RewriteCond</directive>
64
<directive module="mod_rewrite">RewriteCond</directive>
Lines 279-286 the server to fetch the appropriate docu Link Here
279
directive rewrites redirects originating at
280
directive rewrites redirects originating at
280
<code>internal.example.com</code> so that they target the appropriate
281
<code>internal.example.com</code> so that they target the appropriate
281
directory on the local server.  Similarly, the
282
directory on the local server.  Similarly, the
282
<directive module="mod_proxy">ProxyPassReverseCookieDomain</directive>
283
<directive module="mod_proxy">ProxyPassReverseCookieDomain</directive>,
283
and <directive module="mod_proxy">ProxyPassReverseCookiePath</directive>
284
<directive module="mod_proxy">ProxyPassReverseCookiePath</directive>
285
and <directive module="mod_proxy">ProxyPassReverseCookiePathMatch</directive>
284
rewrite cookies set by the backend server.</p>
286
rewrite cookies set by the backend server.</p>
285
<p>It is important to note, however, that
287
<p>It is important to note, however, that
286
links inside the documents will not be rewritten. So any absolute
288
links inside the documents will not be rewritten. So any absolute
(-)httpd-2.4.x.orig/modules/proxy/mod_proxy.c (+18 lines)
Lines 1723-1732 static const char* cookie_path(cmd_parms Link Here
1723
    new = apr_array_push(conf->cookie_paths);
1723
    new = apr_array_push(conf->cookie_paths);
1724
    new->fake = f;
1724
    new->fake = f;
1725
    new->real = r;
1725
    new->real = r;
1726
    new->regex = NULL;
1726
    new->flags = interp ? PROXYPASS_INTERPOLATE : 0;
1727
    new->flags = interp ? PROXYPASS_INTERPOLATE : 0;
1727
1728
1728
    return NULL;
1729
    return NULL;
1729
}
1730
}
1731
static const char* cookie_path_regex(cmd_parms *cmd, void *dconf, const char *f,
1732
                                     const char *r, const char *interp)
1733
{
1734
    proxy_dir_conf *conf = dconf;
1735
    struct proxy_alias *new;
1736
1737
    new = apr_array_push(conf->cookie_paths);
1738
    new->fake = f;
1739
    new->real = r;
1740
    new->flags = interp ? PROXYPASS_INTERPOLATE : 0;
1741
    new->regex = ap_pregcomp(cmd->pool, f, AP_REG_EXTENDED);
1742
    if (new->regex == NULL)
1743
        return "Regular expression could not be compiled.";
1744
    return NULL;
1745
}
1730
static const char* cookie_domain(cmd_parms *cmd, void *dconf, const char *f,
1746
static const char* cookie_domain(cmd_parms *cmd, void *dconf, const char *f,
1731
                                 const char *r, const char *interp)
1747
                                 const char *r, const char *interp)
1732
{
1748
{
Lines 2401-2406 static const command_rec proxy_cmds[] = Link Here
2401
     "a virtual path and a URL for reverse proxy behaviour"),
2417
     "a virtual path and a URL for reverse proxy behaviour"),
2402
    AP_INIT_TAKE23("ProxyPassReverseCookiePath", cookie_path, NULL,
2418
    AP_INIT_TAKE23("ProxyPassReverseCookiePath", cookie_path, NULL,
2403
       RSRC_CONF|ACCESS_CONF, "Path rewrite rule for proxying cookies"),
2419
       RSRC_CONF|ACCESS_CONF, "Path rewrite rule for proxying cookies"),
2420
    AP_INIT_TAKE23("ProxyPassReverseCookiePathMatch", cookie_path_regex, NULL,
2421
       RSRC_CONF|ACCESS_CONF, "Path rewrite rule for proxying cookies"),
2404
    AP_INIT_TAKE23("ProxyPassReverseCookieDomain", cookie_domain, NULL,
2422
    AP_INIT_TAKE23("ProxyPassReverseCookieDomain", cookie_domain, NULL,
2405
       RSRC_CONF|ACCESS_CONF, "Domain rewrite rule for proxying cookies"),
2423
       RSRC_CONF|ACCESS_CONF, "Domain rewrite rule for proxying cookies"),
2406
    AP_INIT_ITERATE("ProxyBlock", set_proxy_exclude, NULL, RSRC_CONF,
2424
    AP_INIT_ITERATE("ProxyBlock", set_proxy_exclude, NULL, RSRC_CONF,
(-)httpd-2.4.x.orig/modules/proxy/proxy_util.c (-5 / +19 lines)
Lines 971-976 PROXY_DECLARE(const char *) ap_proxy_coo Link Here
971
    const char *pathe = NULL;
971
    const char *pathe = NULL;
972
    const char *domaine = NULL;
972
    const char *domaine = NULL;
973
    apr_size_t l1, l2, poffs = 0, doffs = 0;
973
    apr_size_t l1, l2, poffs = 0, doffs = 0;
974
    ap_regmatch_t regm[AP_MAX_REG_MATCH];
974
    int i;
975
    int i;
975
    int ddiff = 0;
976
    int ddiff = 0;
976
    int pdiff = 0;
977
    int pdiff = 0;
Lines 997-1007 PROXY_DECLARE(const char *) ap_proxy_coo Link Here
997
            ent = (struct proxy_alias *)conf->cookie_paths->elts;
998
            ent = (struct proxy_alias *)conf->cookie_paths->elts;
998
        }
999
        }
999
        for (i = 0; i < conf->cookie_paths->nelts; i++) {
1000
        for (i = 0; i < conf->cookie_paths->nelts; i++) {
1000
            l2 = strlen(ent[i].fake);
1001
            if (ent[i].regex) {
1001
            if (l1 >= l2 && strncmp(ent[i].fake, pathp, l2) == 0) {
1002
                if (!ap_regexec_len(ent[i].regex, pathp, l1, AP_MAX_REG_MATCH,
1002
                newpath = ent[i].real;
1003
                                    regm, 0)) {
1003
                pdiff = strlen(newpath) - l1;
1004
                    if (ent[i].real[0] == '!' && ent[i].real[1] == '\0')
1004
                break;
1005
                        break;
1006
                    newpath = ap_pregsub(r->pool, ent[i].real, pathp,
1007
                                         AP_MAX_REG_MATCH, regm);
1008
                    pdiff = strlen(newpath) - l1;
1009
                    break;
1010
                }
1011
            }
1012
            else {
1013
                l2 = strlen(ent[i].fake);
1014
                if (l1 >= l2 && strncmp(ent[i].fake, pathp, l2) == 0) {
1015
                    newpath = ent[i].real;
1016
                    pdiff = strlen(newpath) - l1;
1017
                    break;
1018
                }
1005
            }
1019
            }
1006
        }
1020
        }
1007
    }
1021
    }

Return to bug 54306