Are You Picking the Right Connector: mod_jk, mod_proxy_http & mod_proxy_ajp


News: Are You Picking the Right Connector: mod_jk, mod_proxy_http & mod_proxy_ajp

  1. If you do a Google search on Tomcat Connectors, you will find a lot of old, out dated advice on what connector to choose. In today's computing environment, in a blog posted today on is SpringSource's recommendation to only consider the following connectors:

    Mark Thomas, Spring engineer and Tomcat committer, starts out the article caveating his experience with SpringSource customers:

    My experience with providing support to SpringSource customers is that a typical customer is more likely to hit a bug in mod_proxy_ajp than they are in mod_jk or mod_proxy_http. It isn't that mod_proxy_ajp is particularly buggy, I used it myself for 18 months on a production system without a single issue, but that it has a few more bugs than the other two modules. The situation is improving but at the time of writing I would rank mod_jk and mod_proxy_http above mod_proxy_ajp.

    Ultimately, Thomas breaks it down to four simple rules:

    • If you need to encrpt the httpd to Tomcat channel, use mod_proxy_http
    • If you need to expose SSL information to your web applciation, use mod_jk
    • If you are alreay using one of these modules then changing is likely to cause more hassle than it saves
    • Given a completely free choice, I'd use mod_proxy_http just because the configuration is more consistent with other httpd modules.

    For more details on Mark's guidance, see the original article titled Deciding between mod_jk, mod_proxy_http and mod_proxy_ajp.

  2. Most common scenario[ Go to top ]

    The most common scnario these days on EC2 is multiple instances of Apache and multiple instances of Tomcat. In this scenario, Apache need to forward requests to right Tomcat server based on Cookie (having IP of Tomcat embedded in cookie and Apache proxying request to Tomcat based on the same).


    The arcticle should have addressed this scenrio.

  3. Other articles[ Go to top ]

    Indeed! We have another series from Jon Brisbin, who works for the largest Pizza Hut franchise, who has dealt with this in a pretty unique way. He's open sourced some code on GitHub. The first article deals with keeping track of the availability of services across cloud hosts as they scale up and scale down using a custom Listener he built with JMX and RabbitMQ. Next he's going to share with us how to deal with sessions across clustering. Stay tuned!

  4. just a minor addition...[ Go to top ]

    i'd also consider mod_jk when i need access to any information in the request headers.   for example ip address.

  5. just a minor addition...[ Go to top ]

    we used mod_jk in two projects and never faced even a single issue...

  6. An alternative to mod-jk is mod-cluster (, which can

    • register and unregister workers dynamically with an httpd (no more
    • register and unregister application dynamically (no more urimap.props, no 404s)
    • distribute load to workers according to load balance stats sent from workers to httpd(s)

    This is especially important in clouds where worker instances can be started or stopped dynamically. I have a talk at JBossWorld ( where I describe mod-cluster, plus there's a webinar ( on July 7th, where I'll repeat the talk for those who can't make it to JBW.