Bug 39203 - mod_proxy_balancer does not treat trailing slash like Proxypass directive
mod_proxy_balancer does not treat trailing slash like Proxypass directive
Status: RESOLVED FIXED
Product: Apache httpd-2
Classification: Unclassified
Component: Documentation
2.5-HEAD
Other Linux
: P2 normal (vote)
: ---
Assigned To: HTTP Server Documentation List
http://httpd.apache.org/docs/trunk/mo...
: ErrorMessage
: 39206 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2006-04-04 18:12 UTC by Che Wang
Modified: 2008-08-01 13:36 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Che Wang 2006-04-04 18:12:14 UTC
Running httpd-2.2.0-1 on CentOS 4.3 (rebuilt source rpm package).  Found a bug
with mod_proxy_balancer module where it does not treat a URL the same as
mod_proxy module would.

Using Apache as a reverse proxy with mod_proxy module passing this directive to
a single backend server works just fine:

ProxyPass /KenwoodAccess/ http://172.20.111.33:80/KenwoodAccess/

This next example is a WORKING configuration for mod_proxy_balancer. No errors
are generated in Apache and passes to the backend servers:

ProxyPass /KenwoodAccess balancer://KWA_cluster lbmethod=byrequests
stickysession=JSESSIONID nofailover=off
<Proxy balancer://KWA_cluster>
        BalancerMember http://172.20.111.33:80/KenwoodAccess smax=15 loadfactor=1
        BalancerMember http://172.20.111.34:80/KenwoodAccess smax=15 loadfactor=1
        #BalancerMember http://test.kenwoodaccess.com/noworkers.html smax=15
loadfactor=80
</Proxy>

Where the bug happens:

ProxyPass /KenwoodAccess/ balancer://KWA_cluster lbmethod=byrequests
*NOTE: The trailing slash in the first option.

This will generate an error message in Apache logs:

[Mon Apr 03 17:04:55 2006] [warn] proxy: No protocol handler was valid for the
URL /site/images/buts/forgotpassword.gif. If you are using a DSO version of
mod_proxy, make sure the proxy submodules are included in the configuration
using LoadModule.

This error message seems to be misleading when passing options using the
trailing slash.  How I am interpreting it is mod_proxy_balancer doesn't want to
call on other mod_proxy submodules properly.

Googling shows that people resolved this Apache error message by adding
'LoadModule' for the submodules of mod_proxy (ie: mod_proxy_connect,
mod_proxy_http, etc.).  This is not the case with me, since Apache shows these
submodules as loaded:

httpd -M
 proxy_module (shared)
 proxy_connect_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_ajp_module (shared)
 proxy_balancer_module (shared)

This has been troubleshooted down to trailing slashes as the culprit for
mod_proxy_balancer and mod_proxy Proxypass directive works just fine with
trailing slashes.
Comment 1 Ruediger Pluem 2006-04-04 21:17:14 UTC

> ProxyPass /KenwoodAccess/ http://172.20.111.33:80/KenwoodAccess/

and

> ProxyPass /KenwoodAccess/ balancer://KWA_cluster lbmethod=byrequests

are different cases. In the first case you have a trailing slash at both ends in
the second case you do not have this.


> This will generate an error message in Apache logs:
> 
> [Mon Apr 03 17:04:55 2006] [warn] proxy: No protocol handler was valid for the
> URL /site/images/buts/forgotpassword.gif. If you are using a DSO version of
> mod_proxy, make sure the proxy submodules are included in the configuration
> using LoadModule.

Please specify the request that leads to this error message.

Please set also the LogLevel to debug and attach the output of your error_log file.
Comment 2 Ruediger Pluem 2006-04-04 22:11:53 UTC
*** Bug 39206 has been marked as a duplicate of this bug. ***
Comment 3 Noah Schoenholtz 2006-05-18 22:12:17 UTC
I had the same issue, and this does not necessarily mean that is not a bug but I
have at least discovered a workaround.

In my case, within a certain Virtual Host I pass all requests to the Load
Balancer. This received the same errors when configured as follows:

ProxyPass / balancer://cluster nofailover=On
ProxyPassReverse / balancer://cluster
<Proxy balancer://cluster>
  BalancerMember ajp://10.0.1.102:8009
  BalancerMember ajp://10.0.1.103:8009
</Proxy>

But works if the configuration is changed to this:

ProxyPass / balancer://cluster/ nofailover=On
ProxyPassReverse / balancer://cluster/
<Proxy balancer://cluster/>
  BalancerMember ajp://10.0.1.102:8009/
  BalancerMember ajp://10.0.1.103:8009/
</Proxy>
Comment 4 Ruediger Pluem 2006-05-25 12:30:45 UTC
I agree that the error message is misleading, but this problem is not limited to
mod_proxy_balancer and the balancer scheme but also occurs with

ProxyPass / http://www.somewhere.com

(it must be ProxyPass / http://www.somewhere.com/)

So the problem is really a misconfiguration on the user side that I mark as a
WONTFIX.
Comment 5 Bob Ionescu 2006-05-25 12:53:54 UTC
(In reply to comment #4)
> ProxyPass / http://www.somewhere.com
> 
> (it must be ProxyPass / http://www.somewhere.com/)
> 
> So the problem is really a misconfiguration on the user side that I mark as a
> WONTFIX.

May be the manual should be updated, too, because three or four examples
provided under the ProxyPass directive are using such invalid syntax.
Comment 6 Ruediger Pluem 2006-05-25 13:23:17 UTC
(In reply to comment #5)
> 
> May be the manual should be updated, too, because three or four examples
> provided under the ProxyPass directive are using such invalid syntax.

Ok, agreed, but strictly speaking only the balancer example is wrong. 

ProxyPass /example http://backend.example.com

is correct again. The basic rule for this is:

If the left side of ProxyPass ends with a / the right side must also end with a
/. If the right side of ProxyPass ends with a / but the left side does not this
will cause // in the URL send to the backend which usually does not harm, but to
play safe both sides really should end in the same manner. Maybe an idea for a
sanity check that issues a warning to the error log during the configuration
parsing of the ProxyPass directives if this is not the case.
Comment 7 Ruediger Pluem 2006-05-25 20:15:51 UTC
I have added a note to the documentation regarding trailing slashes: r409455
(http://svn.apache.org/viewvc?rev=409455&view=rev)
Comment 8 Takashi Sato 2008-06-06 08:54:07 UTC
backported to 2.2
<http://svn.apache.org/viewvc?rev=663989&view=rev>
Comment 9 Nick Stielau 2008-08-01 10:29:46 UTC
I think this is still a problem, because you cannot achieve the same behavior using the balancer as you can without using it:

Not using balancer

    ProxyPass /MyService http://example.com:20000/MyService                        
    ProxyPassReverse /MyService http://example.com:20000/MyService

this sends a request for /MyService?wsdl to http://example.com:2000/MyService?wsdl

Using the balancer

    ProxyPass /MyService balancer://playlist_service_balancer

    <Proxy balancer://playlist_service_balancer>
      BalancerMember http://example.com:10000/MyService
      BalancerMember http://example.com:20000/MyService

      ProxySet lbmethod=byrequests
    </Proxy>

There are no trailing slashing at all, yet this sends a request for /MyService?wsdl to http://example.com:2000/MyService/, forcing a trailing slash.
Comment 10 Ruediger Pluem 2008-08-01 13:36:44 UTC
Try using

ProxyPass /MyService balancer://playlist_service_balancer/MyService

    <Proxy balancer://playlist_service_balancer>
      BalancerMember http://example.com:10000/
      BalancerMember http://example.com:20000/

      ProxySet lbmethod=byrequests
    </Proxy>