RSS LinkedIn Twitter

Apache mod_proxy_balancer: No Protocol handler was valid

Just this afternoon, one of my colleagues and I were discussing our feelings about the “semicolon-class” of bugs that developers will inevitably spin their wheels on from time to time. I’ve had just such an experience the past two evenings with what started out as a simple recipe from the Apache Cookbook, entitled “Load Balancing with mod_proxy_balancer”.

The recipe itself is straightforward, taking up just over a page. I was able to get a basic load balancer working within a few minutes by following the recipe, but for some reason I couldn’t get the balancer-manager site to load correctly. The following directives should configure the balancer-manager:

SetHandler balancer-manager
  Order Deny,Allow
  Allow from all

When I would start the server, however, I got an HTTP 500 error response, with this message in the log:

[Tue Feb 02 12:49:09 2010] [warn] proxy: No protocol handler was valid for the URL /balancer-manager. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

My searches on Google were fruitless: most people were able to solve the problem by ensuring these lines were added to their httpd.conf:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so

But they were already included in my conf file, so no dice. Other people solved their problem by loading the mod_proxy_html.so, which doesn’t come on a standard install of Apache. I ended up compiling it from source (learned a lot about compiling Apache shared modules) but that didn’t work for me either.

Eventually I realized that the only time my requests were being proxied to the BalancerMembers was when I was at the URL root, for example tacking on an ‘index.php’ to the URL would generate the same error as trying to access ‘balancer-manager’. And about that time I stumbled upon a user who was able to solve their problem by adding a few rewrite rules… which caused me to finally understand part of my problem.

The reason ‘balancer-manager’ wasn’t loading correctly was because that request was being proxied to the BalancerMember, which didn’t have ‘balancer-manager’ enabled (hence the ‘no protocol handler error’). This still didn’t explain why ‘index.php’ wasn’t working, either, since I knew index.php was on the BalancerMembers.

These discoveries quickly culminated into leading me to my solution, which was a missing trailing-slash in my ProxyPass directive. That’s what was causing my ‘index.php’ to not be proxied. Once I realized the problem was in my ProxyPass– reading the documentation also taught me that there’s a way to keep certain requests from being proxied (which solved my ‘balancer-manager’ issue).

So I present to you, my completed (and functional) balancer.conf. And remember, the trailing slash at the end of the ProxyPass directive IS CRUCIAL!
ProxyPass /balancer-manager !  # Prevents balancer-manager from being proxied.
ProxyPass / balancer://mycluster/
ProxyPassReverse / balancer://mycluster/
 
  BalancerMember http://10.0.0.10 loadfactor=2
  BalancerMember http://10.0.0.11
  BalancerMember http://10.0.0.12
 
 
  SetHandler balancer-manager
  Order Allow,Deny
  Allow from all

I hope this saves someone some time when searching on the particular error message I got. Now I’m off to figure out how to get my web servers to auto register with the balancer-manager. I will blog about it when I figure it out.

Tags: , , ,

14 Responses to “Apache mod_proxy_balancer: No Protocol handler was valid”

  1. August 5th, 2010 at 00:50
    1

    It sure did save me some time! I hit the problem, googled it, found and applied your solution all within 15 minutes!

    Thanks very much!

    Now we just need the Apache documentation to be updated.

    Cheers

    Iain

  2. Stefan
    September 13th, 2010 at 13:24
    2

    Many thanks from me as well! You just saved me probably a couple of hours tearing my hair out late at night…

  3. Josef
    October 7th, 2010 at 03:19
    3

    Thanks for this. I spent a lot of time searching on google in vain until I came across this!

  4. November 11th, 2010 at 09:43
    4

    Thanks a lot for it. It saved me a great deal of time

  5. Joao Gabriel
    September 30th, 2011 at 17:43
    5

    Man o man!!

    Thank you so much!!! The trailing slash at the end of ProxyPass was my problema also!!! Saved my day!

  6. Joel
    November 5th, 2011 at 02:04
    6

    Thanks dude!! It was really helpfull.

    Muchas gracias..

  7. ARTEM
    November 7th, 2011 at 08:29
    7

    Where is my error in this config?

    ServerName test.xxx.ua
    ServerAdmin it@capcipa.biz
    DocumentRoot “d:/www/xxx_xxx”
    ErrorLog logs/xxx/info-error_log
    CustomLog logs/xxx/info-access_log common
    #AddDefaultCharset UTF-8

    ProxyPass / balancer://test.xxx.ua
    ProxyPass /balancer-manager !

    BalancerMember http://testdl2.xxx.ua/ loadfactor=50 route=xxx.xxx.xxx.xx9
    BalancerMember http://t.xxx.ua/ loadfactor=50 route=xx.xxx.xxx.xx3

    SetHandler balancer-manager
    Order Deny,Allow
    Allow from all

  8. ARTEM
    November 7th, 2011 at 08:31
    8

    Where is my error in this config?

    ServerName test.xxx.ua
    ServerAdmin it@xxx.biz
    DocumentRoot “d:/www/xxx_xxx”
    ErrorLog logs/xxx/info-error_log
    CustomLog logs/xxx/info-access_log common
    #AddDefaultCharset UTF-8

    ProxyPass / balancer://test.xxx.ua
    ProxyPass /balancer-manager !

    BalancerMember http://testdl2.xxx.ua/ loadfactor=50 route=xxx.xxx.xxx.xx9
    BalancerMember http://t.xxx.ua/ loadfactor=50 route=xx.xxx.xxx.xx3

    SetHandler balancer-manager
    Order Deny,Allow
    Allow from all

  9. November 7th, 2011 at 08:36
    9

    Try changing:
    ProxyPass / balancer://test.xxx.ua
    to
    ProxyPass / balancer://test.xxx.ua/

    ( Notice the trailing ‘/’ )

  10. October 25th, 2012 at 10:42
    10

    The trailing slash made me to waste so much time! Thanks for your hint.

  11. ps
    January 1st, 2013 at 16:00
    11

    Very kind of you. I setup tomcat as a load balancer for my two tomcat instances. If I went to:
    http:/LOADBALANCER:PORT/

    It would load the tomcat file but would complain the images:
    proxy: No protocol handler was valid for the URL /tomcat.gif

    After adding the trailing slash this issue went away.

  12. Rune Hellem
    January 16th, 2013 at 14:56
    12

    Ahh, trailing slash, tnx!

  13. April 18th, 2013 at 07:12
    13

    Thank You So much………………… 🙂

  14. Luke
    September 27th, 2013 at 03:01
    14

    Thanks so much

Leave a Comment

*