On Wed, Sep 5, 2012 at 6:08 PM, Zisis Lianas <zisis.lia...@consol.de> wrote: > There seems to be some problems when trying to proxy "/" with > ProxyPass and mod_proxy_balancer. > > See also: > https://issues.apache.org/bugzilla/show_bug.cgi?id=51982 > https://issues.apache.org/bugzilla/show_bug.cgi?id=51489 > > I could reproduce both errors in httpd-2.4.3: > 1) error 500 when configuring "ProxyPass / balancer://default" > 2) double-slash problem when backend returns 301 > > > > Sample config: > ######################################## > ProxyPreserveHost Off > <Proxy balancer://default> > BalancerMember http://backend1.foo:5080 route=0 > BalancerMember http://backend2.foo:5080 route=1 > ProxySet lbmethod=bybusyness nofailover=off > stickysession=JSESSIONID|jsessionid > </Proxy> > > ProxyPass / balancer://default > ProxyPassReverse / balancer://default > ######################################## > > > 1) > When configuring "ProxyPass / balancer://default", an error 500 > occurs. When using a different ProxyPassMatch config, everything > works fine, e.g.: ProxyPassMatch ^/(.*)$ balancer://default/$1 > > I broke it down to mod_proxy.c::ap_proxy_trans_match(). > "r->filename" resp. "found" is set to "proxy:balancer://defaultclusterjsp" > when for e.g. the URL "http://mydomain.foo/clusterjsp" is called. > "r->filename" should be "proxy:balancer://default/clusterjsp". > > I wrote a patch for httpd-2.4.3 (attached) - maybe someone can > review and improve it to get it finally in trunk.
This is because the configuration is incorrect. Your ProxyPassMatch corresponds to this ProxyPass line ProxyPass / balancer://default/ Not this ProxyPass / balancer://default The trailing slash is relevant, as you have found out. > > > 2) > When the patch from 1) is applied, you will run into another problem. > On 301 from backend, an dispensable "/" will be prepended to the URI. > E.g. when you call http://mydomain.foo:8080/clusterjsp in you browser, the > redirect location will be set wrong: > Location: http://mydomain.foo:8080//clusterjsp/ > > This will result in session problems... (cookie path is "/clusterjsp" and > not "//clusterjsp"). > > See attached logfile for more details. > > A patch was proposed in > https://issues.apache.org/bugzilla/show_bug.cgi?id=51489 > for httpd-2.4.x, which is working for me. > > I did a quick check with: > u = apr_pstrcat(r->pool, (strcmp(ent[i].fake, "/") == 0 ? "" : ent[i].fake), > &url[l2], NULL); This "problem" comes from incorrectly fixing problem 1. Cheers Tom