Deciding between mod_jk, mod_proxy_http and mod_proxy_ajp

posted by mthomas on June 16, 2010 07:06 AM

Over the years there have been a number of connectors developed to enable Apache httpd to communicate with Tomcat that have used a variety of protocols. When searching the web for information on how to do this, it isn't unusual to stumble across some really bad, out of date advice. So first of all the only options you should consider for this are:

All of the other other options have not been supported for a number of years so you should avoid mod_jk2, mod_jserv, mod_webapp and any other module that isn't discussed here.

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.

That brings us to the crunch question: mod_proxy_http or mod_jk? And the answer? It depends! Both modules have their strengths and weaknesses. Which one is right for you will depend on your circumstances. The factors that normally affect this choice are:

  • Is one module already in use?
  • Does the communication between httpd and Tomcat need to be encrypted?
  • Does httpd terminal SSL but the SSL information needs to be passed to Tomcat?

If you are already using mod_jk or mod_proxy_http and it meets all of your requirements then there is unlikely to be a good reason to change it. It would be better to stick to what you are currently using and to have consistency across your httpd instances.

If you need to encrypt the communication between httpd and Tomcat then this is significantly easier with mod_proxy_http when you can just switch from the http to the https protocol. mod_jk uses the AJP protocol which doesn't support encryption so you have to implement that separately via an SSH tunnel, IPSec or similar. This can add significant configuration complexity to the httpd-Tomcat communication channel.

Where httpd terminates the SSL, providing the SSL attributes are exposed (two simple directives) then mod_jk automatically passes this information to Tomcat and Tomcat makes it available to web applications without any additional configuration required. To achieve the same result with mod_proxy_http requires httpd to be configured to add the SSL information as http headers and a Valve needs to be configured in Tomcat to extract this information and to make it available to web applications. Making SSL information available to Tomcat is therefore a little more complicated with mod_proxy_http.

mod_jk and mod_proxy_http also have very different configuration styles. The mod_proxy_http directives are consistent with other httpd directives whereas mod_jk uses an external property file. For system administrators familiar with httpd, the mod_jk approach can look a little odd.

In summary:

  • If you need to encrypt the httpd to Tomcat channel, use mod_proxy_http
  • If you need to expose SSL information to your web application, use mod_jk
  • If you are already 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.

Mark Thomas is a Senior Software Engineer for the SpringSource Division of VMware, Inc. (NYSE: VMW). Mark has been using and developing Tomcat for over six years. He first got involved in the development of Tomcat when he needed better control over the SSL configuration than was available at the time. After fixing that first bug, he started working his way through the remaining Tomcat bugs and is still going. Along the way Mark has become a Tomcat committer and PMC member, volunteered to be the Tomcat 4 & 7 release manager, created the Tomcat security pages, become a member of the ASF and joined the Apache Security Committee. He also helps maintain the ASF's Bugzilla instances. Mark has a MEng in Electronic and Electrical Engineering from the University of Birmingham, United Kingdom.


why not mod_rewrite

We are using mod_rewrite in our project for communication between apache and tomcat. We are using mod_rewrite as it allows us finer control to redirect only certain subset like *.do to tomcat. Where as same needs to be done by LocationMatch for mod_poxy.

ON what basis is this comparison done? Was mod_rewrite considered?

mod_rewrite is an alternative

mod_rewrite is an alternative way of doing pretty much anything in httpd. The general rule with mod_rewrite is that if there is a more specific directive then it is better (clearer configuration, better performance) to use the more specific directive. Hence, my article focussed on mod_proxy and mod_jk.

In your example, there is no need to use a LocationMatch plus a ProxyPass, you could use ProxyPassMatch.

In the last two years I can think of one example where I used mod_rewrite to configure the reverse proxy and that was where the client wanted to select the back-end server based on part of the query string.

Cool you write, the

Cool you write, the information is very good and interesting, I'll give you a link to my site. Save The Marriage System

Cool you write, the

Cool you write, the information is very good and interesting, I'll give you a link to my site. Ways To Get Your Ex Back

Cool you inscribe, the info

Cool you inscribe, the info is really salubrious further fascinating, I'll give you a connect to my scene. Survive In Bed

I use basically superior

I use basically superior fabrics : you will discover these products by: geriatric medicine

It is somewhat fantastic, and

It is somewhat fantastic, and yet check out the advice at this treat. How To Give A Hand Job

Its a great pleasure reading

Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work.locksmith miramar

Cool you write, the

Cool you write, the information is very good and interesting, I'll give you a link to my site. How to Turn a Guy On

During this website, you will

During this website, you will see this shape, i highly recommend you learn this review. Bonding Code


This is a website for all delhi escorts for pleasure and fun for time pass getting a girlfriend for sometime etc etc... online custom writing



I like this post,And I figure that they having a great time to peruse this post,they might take a decent site to make an information,thanks for sharing it to me. online custom writing


Pure class article! Laser

Pure class article! Laser Printer Drum


Vick and Newton, for all their breathtaking play, never receive the blessing of being described in such spiritual and transcendent language. michael spencer gilroy



I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job! Apprendre la photo


Fantastic stuff, mate!!!

Fantastic stuff, mate!!! débarras gratuit maison paris

thanks a lot

documents and photos directly from memory cards; the MX895 features a 7.5cm display whilst the MX715 has a 6.2cm display. The new Dual Function Panel, from which the user operates the printer, features LED-lit dual purpose keys. readmore Free Printer Driver Download Only the keys needed for the function being performed are lit up, for greater ease of use. A comprehensive suite of intuitive software for photo and document printing and scanning comes as standard on the new MX devices. readmore go to website Smart and efficient web printing is enabled through Easy-WebPrint EX, which allows multiple web pages to be clipped and then combined on one page, to minimise paper and ink wastage.¹ readmore .rpm Easy Photo-Print EX software means users can impress friends and family by creating and printing perfectly formatted photo albums and calendars. The software also offers a range of editing options, such as Red Eye Correction and Digital Face Smoothing. readmore Epson driver download The new PIXMA printers also support Full HD Movie Print, which gives users the ability to capture and print beautiful still images from Full HD video footage shot on Canon’s range of Digital SLRs or Canon Digital Still Cameras. . you could save thousands at the pumps by mainly using the battery. And the savings don’t end there.Company car buyers will benefit greatly. When the i8 was introduced in 2014 it sat in the 5% BIK band, meaning company car tax could be as low as £998 per year. readmore uk car review Sadly (and predictably) it’s now in the 9% band (for 2015/16) and will shift up to 11% for 2016/2016 – but that still significantly undercuts traditional sports car rivals.

im fine


Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative. Tiger Woods to become first billionaire sportsman by 2010 is very nice. allscreendoors



A child asked God: "If everything was written in fate so why should the convention?" grant boxing gloves


Your blog provided us with

Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging,
post office change of address


wow, great, I was wondering how to cure acne naturally. and found your site by google, learned a lot, now i’m a bit clear. I’ve bookmark your site and also add rss. keep us updated. nutribullet at walmart



It increases the metabolism which, in turn, leads to better energy levels throughout the day and to a higher fat burning rate. delonghi coffee machines



Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more. debenhams bedding sale



wow, great, I was wondering how to cure acne naturally. and found your site by google, learned a lot, now i’m a bit clear. I’ve bookmark your site and also add rss. keep us updated. Best Money Lender Bukit Batok


I would like to thank you for

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well..
translation services nyc


Howdy! Pleasant stuff, do update me as often as possible when you post again something like this! FREE Weight Loss PDF Guide



This is an amazing article to read, mate. The information here is just absolutely outstanding. This is, without a doubt, one of the best articles that I've read recently. Brilliant work!



You have a real ability for writing unique content. I like how you think and the way you represent your views in this article. I agree with your way of thinking. Thank you for sharing. equine classifieds



I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. craigslist flagging service



I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. web development



I am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me. HCG explanation on Scoop It


Its a great pleasure reading

Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work.
SSC Ki Tayari

Great post I would like to

Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article.
Georges Sadala Rihan

Wonderful article, thanks for

Wonderful article, thanks for putting this together! This is obviously one great post. Thanks for the valuable information and insights you have so provided here.
reputacao online

I really appreciate the kind

I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day!
webwinkel horloge

Hi, I find reading this

Hi, I find reading this article a joy. It is extremely helpful and interesting and very much looking forward to reading more of your work..
Calgary Movers


Very interesting blog. Alot of blogs I see these days don’t really provide anything that I’m interested in, but I’m most definately interested in this one. Just thought that I would post and let you know. craigslist posting service


You’ve got some interesting

You’ve got some interesting points in this article. I would have never considered any of these if I didn’t come across this. Thanks!.
sinus pressure relief

Thank you for helping people

Thank you for helping people get the information they need. Great stuff as usual. Keep up the great work!!!
how to get an ein

Thanks for sharing this

Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people..

I was looking at some of your

I was looking at some of your posts on this website and I conceive this web site is really instructive! Keep putting up..
restaurants near me


This is highly information, crisp and clear. I think that everything has been described in systematic manner so that reader could get maximum information and learn many things.
restaurants near me

I felt very happy while

I felt very happy while reading this site. This was really very informative site for me. I really liked it. This was really a cordial post. Thanks a lot!.

Fantastic. noticias

Fantastic. noticias

Yes i am totally agreed with

Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!THANKS!!!!!!
Theme Dojo

I am very enjoyed for this

I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy.
​arborist omaha

I think that thanks for the

I think that thanks for the valuabe information and insights you have so provided here.
tree trimming omaha

It’s appropriate time to make

It’s appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I wish to suggest you few interesting things or advice. Perhaps you could write next articles referring to this article. I desire to read even more things about it!

Keep up the good work , I

Keep up the good work , I read few posts on this web site and I conceive that your blog is very interesting and has sets of fantastic information.
anthony robbins

The explanation behind

The explanation behind utilizing just the Strats made inside this four year time frame is the way that Fender conveyed them with a bigger headstock. Malmsteen is persuaded that this bigger headstock decidedly influences the maintain of the guitar. All things considered, the majority of his Stratocasters are intensely changed. These alterations incorporate minor things, for example, supplanting the springs on the tremolo connect with Wilkinson ones, to totally changing over the neck and scalloping the fretboard. Diverse pickups are a standard for the majority of his Strats. Indeed, even with the majority of the adjustments, Fender has chosen to make a Malmsteen signature display, which is just the second mark arrangement they made after Clapton's. Yngwie Malmsteen Stratocaster accompanies a large portion of the mods found on any of Yngwie's own Strats, with the consideration of Seymour Duncan YJM Fury pickups.
Dimebag Darrell Rig Rundown

Post new comment

This question is for testing whether you are a human visitor and to prevent automated spam submissions.