Summary: | ProxyPassReverse adds an additional slash in load balancer setups | ||
---|---|---|---|
Product: | Apache httpd-2 | Reporter: | Micha Lenk <micha> |
Component: | mod_proxy | Assignee: | Apache HTTPD Bugs Mailing List <bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | nsg-apache-httpd-maintenance, sven.peters |
Priority: | P2 | ||
Version: | 2.4.2 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux | ||
Attachments: |
Fix additional slash added by ProxyPassReverse in LoadBalancer setup
Fix for Apache 2.4.2 (including fix for PR #45434) Fix additional slash in load balancer setups |
Description
Micha Lenk
2011-07-08 16:16:23 UTC
I found out that I have no issue at all if the config consistently uses a slash after the load balancer id. <Proxy balancer://196f045aca6adc82a0b6eea93ed286a1/> BalancerMember http://server-1.local/ status=-SE BalancerMember http://server-2.local/ status=-SE </Proxy> <VirtualHost 10.8.16.33:80> ServerName frontend.local <Location /> ProxyPass balancer://196f045aca6adc82a0b6eea93ed286a1/ ProxyPassReverse balancer://196f045aca6adc82a0b6eea93ed286a1/ </Location> </VirtualHost> So, please consider the case as solved and the patch as void. No, consistently using a slash after the load balancer id does *not* help: In this case every backend request gets an additional slash before the path. Maybe we should fix *this* issue then... Please test <Proxy balancer://196f045aca6adc82a0b6eea93ed286a1> BalancerMember http://server-1.local/ status=-SE BalancerMember http://server-2.local/ status=-SE </Proxy> Does this then result in doubled-slashes? yes Does somebody have a patch for 2.2.22 for this? The above patch seems to be for an older version and the logic seemed to have changed (I only checked .21 and .22). I can work on an updated patch (added to my TODO list), but I will need some time for it due to a lot of other things keeping me busy at the moment... I just tried to reproduce the issue again with Apache 2.4.2. Now the directive doesn't work at all in a load balancer setup. :( This tiny patch for Apache 2.4.2 makes the ProxyPassReverse work again in a load balancer setup, however, the initially reported bug with the additional slash is then still unfixed: --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -852,6 +852,7 @@ PROXY_DECLARE(const char *) ap_proxy_location_reverse_map(request_rec *r, (balancer = ap_proxy_get_balancer(r->pool, sconf, real, 1))) { int n, l3 = 0; proxy_worker **worker = (proxy_worker **)balancer->workers->elts; + real += strlen(BALANCER_PREFIX); const char *urlpart = ap_strchr_c(real, '/'); if (urlpart) { if (!urlpart[1]) Ok, issue from last comment is already fixed in trunk via PR #45434. Created attachment 29145 [details]
Fix for Apache 2.4.2 (including fix for PR #45434)
Using gdb I just figured out what went wrong. Attached you can find my patch that made all things work for me using Apache 2.4.2.
I also tried to craft a test case for this issue, but for whatever reason the test harness does not fail (maybe related to the intense usage of non-default ports in the test setup).
Ah, I missed this bug before, sorry. Yes, this is fixed for the next 2.4.x release, I'll update CHANGES to ref this bug since it's a different bug to the 2.2 issue, and a regression. I fear you got me wrong. The changeset you committed in SVN rev. 1374264 should be reverted, as the bug that got fixed in branch httpd-2.4.x by SVN rev. 1365604 is PR 45434 only. The issue that I reported in PR 51489 is *not* fixed by changing the CHANGES file only (as in SVN rev. 1374264). Or did I miss anything? Oh, I see. Sorry, no, I missed the point. Created attachment 29248 [details]
Fix additional slash in load balancer setups
I've just rewritten the patch to catch the problem more precisely.
The patch from previous comment is based on branch httpd-2.4.x, SVN rev. 1374290. |