Running a web server in front of a java application server makes sense in almost all production scenarios, where end users from the internet connect directly to your site. The web server offers you much more configuration, security and performance features than the integrated http connector of any java application server. Software developers sometimes argue, that it should work (and of course it does). But if you want to speed up your website and tune your weblayer with optimizing settings like cache-control headers, turn of Etags and so on, a java application server doesn’t allow you to modify this settings.
Therefore, web servers like apache httpd are running in front of the application server and you can configure almost everything you want with apache httpd and apache modules. The connections from apache to the java application server (cluster) are configured through additional apache modules. Commercial Vendors like BEA offers you apache modules for Weblogic to connect. For Tomcat we saw a lot of different modules over the last years. These were mod_jk, mod_webapp, mod_jk2 and the return of mod_jk. With apache 2.2, there’s a build in module, called mod_proxy_ajp. The connection from apache to tomcat with the mod_jk or the mod_proxy_ajp is done by the AJP protocol, which is a binary protocol and faster than http. Before apache 2.2 and its mod_proxy_ajp module, some people used mod_proxy as a revers proxy from apache to tomcat. This might be good for small web sites, and if you do not need to pass some additional informations to you app server.
Now to glassfish. Currently, glassfish V1 and V2 ships only with a http connector module. There’s no apache httpd mod_glassfish or something like that. You can connect with httpd’s mod_proxy_reverse.
But regarding some blog entries from Jean-Francois Arcand and Amy Roh, it’s possible to extend glassfish with the libs ( tomcat-ajp.jar modeler-1.1.jar commons-logging-1.0.4.jar) from tomcat and tweak some config files.
But stop. Are there different versions of these jars? Which jar version fits to which glassfish version?
Some people already blogged about their problems to extend glassfish withe the ajp protocol.
Why does the glassfish distribution currently do not bundle the ajp libs and missing configurations in the config files?
In my opinion, it is very very important for the future success of glassfish, to offer build in connectors to apache (with ajp), to Sun JES Web Server (an NSAPI Module?) and MS IIS . These connectors should be well documented and easy to configure for admins and developers.

Hi Thorleif, can you file an RFE about bundling mod_jk with GlassFish.
https://glassfish.dev.java.net/servlets/ProjectIssues
I think this is a good idea. Hopefully we can staff a resource to do it in time for v2
Thanks
– Jeanfrancois
Hi Jeanfrancois,
thank you for your response on that.
As suggested, I created issue #3078 for that.
https://glassfish.dev.java.net/issues/show_bug.cgi?id=3078
–
Thorleif Wiik
Very good idea to include it in v2
Hello,
Is this still a problem with latest glassfish ? Is there a straight way to integrate glassfish with apache httpd ?
Drop me an email!
Thanks!
Q
very nice web site. My English is not so good, so I do not understandt it well, but it seems very good. Thanks
Yeah, you suggestion seems like a no-brainer but they sure are dragging their feet about it. And talk about crap docs, there are all sorts of blogs telling you this and that but none seems to work very well. Hey glassfish guys, ever heard of documentation? It’s 50%+ of a programmer’s job!
it looks like a nice site, but it would better with multi language support, for example spanish.. but thanks..
it would be better with other languages support, but thanks..
So is mod_jk bundling with GlassFish v2 now?
No need to drop in tomcat-ajp.jar to glassfish/lib?
However I could not get failover to work
I’ve read the various blogs here and there plus the official sun doc about ha.
e.g. http://blogs.sun.com/jluehe/entry/supporting_apache_loadbalancer_with_glassfish
mod_jk at apache works fine. Load-balancing ok. But still very hard to know why failover doesn’t work at glassfish+mod_jk.
Any idea? Thank you!
Hi Wilfred, mod_jk made it into Glassfish v3, not v2. I think there is also a lack in information about the possibilities with apache 2.2 mod_proxy_balancer. http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html . You can use this instead of using mod_jk in apache.
Nice article. Thnx
hi to all….
Iam a student.. Iam using neatbens 6.1, Glassfish.. Now, i have a xampp in my PC..
I want to run my JSP file in my APACHE.. please for God sake help me to make it happen.. coz, i realy dont know wat to do..
How to Configure my APACHE….so that my glassfish will connect to my APACHE?
Thanks and GOD bless..
please..
please..
please….
for those ho have the answer…. u can mail me at this email..
code000101@yahoo.com… thnks.. God Bless you always out there..
This blogpost is kind of old, but just make sure you know this (look Ma, no Apache!):
http://maryniuk.blogspot.com/2009/09/bye-bye-apache.html
Riveting place
:):):):):), Good to see more people writing about this subject.
I’ve been looking for a while for a good read about this issue . Searching in Google I found this blog. After going over this information I’m really happy to say that I have finally found exactly what I was searching for. I will make sure to remember http://www.wiik.de/blog/2007/05/27/glassfish-and-apache/ and come again more often . Thanks!
Hallo an Euch.
Danke für den gut geschriebenen Beitrag.
Werde jetzt öfters mal vorbei schauen.(Drohung HEHE)
Ist gebookmarked.
Bis denne.
Peter