Glassfish JSF/EAR Apache 2.2 proxy_ajp_mod Referred Content Missing (images/links/etc)

Posted by BillR on Server Fault See other posts from Server Fault or by BillR
Published on 2012-09-20T16:11:04Z Indexed on 2012/09/24 21:39 UTC
Read the original article Hit count: 125

Full disclosure: Since this seems to be more of a configuration issue, I deleted this from Stack (where it wasn't getting any response) and reposted here.

The problem is how to change the requestContextPath served up by Glassfish behind mod_proxy_ajp. The site/app runs fine if connecting directly to Glassfish port 8080 which is ultimately not what I want to do.

So I need help with configuration for my servers and jsf deployment. I can see the issue but don't know how to resolve it. It has to do with the requestContextPath.

  • Simply put, Apache directs to http://mysite.com/welcome.xhtml which is correct and what I want, but the page is minus the images and styles.

  • The issue is Glassfish itself is still pointing to http://mysite.com/myapp/*. So all links it serves in the app/site still refer via the requestContextPath. That is the /myapp/* part of http://mysite.com/myapp/welcome.xhtml.

  • When I look in the page source, images which are referred to with relative links still point to the requestContextPath (that is, /myapp/). This is fixable but a real pain.

However with page links I can't set the relative path.

  • If I hover over the contact page link I see http://mysite.com/myapp/contact.xhtml, and if I click it, I get 404. You can see the /myapp/ context path in the page source as well.

  • If I type in the URL http://mysite.com/contact.xhtml I get the page minus its referred links (requestContextPath).

On Apache

ProxyPass / ajp://littlewalterserver:8009/myapp-web/

ProxyPassReverse / ajp://littlewalterserver:8009/myapp_Project-web

On Glassfish

asadmin create-network-listener --listenerport 8009 --protocol http-listener-1 --jkenabled true jk-connector

I have tried going in to Glassfish and setting the web app as the default web app. I have changed the / in glassfish-web.xml (and checked to make sure it was the same in the EAR file).

How can I get Glassfish to not include the /myapp/ context in the URLs? This has to be easy if you know how, but I don't know how, can someone help out here? Thanks.

© Server Fault or respective owner

Related posts about apache2

Related posts about mod-proxy