0

our IT is trying to configure a new apache/jboss/apj setup. When I browse to http://domain.com/jboss/test.jsp

and echo out the request.getRequestURL() I get
http://domain.com/test.jsp (without jboss) My deployed app encounteres a lot of 404's because of this.

This is what our IT department has the ProxyPassReverse set to.

<Location /jboss>
    ProxyPass balancer://cluster stickysession=JSESSIONID 
    ProxyPassReverse https://domain.com/jboss/
</Location>

Shouldn't the directive be set to:

<Location /jboss>
    ProxyPass balancer://cluster stickysession=JSESSIONID 
    ProxyPassReverse /jboss https://domain.com/jboss/
</Location>

Edit The issue arrises when I use response.sendRedirect

On our old server I used
response.sendRedirect("login.jsp?message=You have successfully logged off.");

to get things to work with the new proxy I have to recode as
response.sendRedirect("/jboss/AppName/login.jsp?message=You have successfully logged off.");

My applications are no longer portable or reuseable with the latter syntax. That line is in an my framework servlet for logging out and is shared by all of my apps.

The error (in Apache, not jboss) for
response.sendRedirect("login.jsp?message=You have successfully logged off."); File does not exist: /folder1/folder2/AppNamelogin.jsp`
Note there is no "/" between my appname and login.jsp

The error (in Apache, not jboss) for
response.sendRedirect("/login.jsp?message=You have successfully logged off."); File does not exist: /folder1/folder2/login.jsp Note the AppName is missing

jeff
  • 101
  • 3
  • Is the JBoss-server setup with the `/jboss` context? – pkhamre Jul 25 '12 at 13:30
  • I beleive so but I don't have access to directly view the apache configuration. I'd have to ask IT but they always seem annoyed when developers ask them questions :) I'd like to just tell them here is what ProxyPassReverse should be set to. – jeff Jul 25 '12 at 14:06

1 Answers1

1

Nope; the first argument is implied when used in a <Location> block. That usage is correct.

ProxyPassReverse serves only to translate the Location header on a 30x redirection response; it's probably not the issue, given what you've described.

You should clarify exactly what the path should be set to. If I understand you right, the request should be sent to domain.com/jboss/test.jsp instead of the current domain.com/test.jsp, right? If that's the case, then just change..

ProxyPass balancer://cluster stickysession=JSESSIONID 

..to..

ProxyPass balancer://cluster/jboss stickysession=JSESSIONID

Edit

Leaving the above in place, but the new information presented makes it clear that the problem is indeed with the ProxyPassReverse - the balancer configuration probably has the /jboss path in the BalancerMember configs.

Change..

ProxyPassReverse https://domain.com/jboss/

..to..

ProxyPassReverse https://domain.com/jboss

The slash is being stripped when the Location translation is occurring, sending the client a redirect to /jbossappname instead of /jboss/appname, due to the imbalanced trailing slashes between the <Location /jboss> and the ProxyPassReverse.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • Shane. Correct. I expect the request.getRequestURL() to have jboss in the url. Or in other words what ever URL is typed in the Address bar, request.getRequestURL() should return an exact match. IT has our AS7 apps pointing to https://domain.com/jboss/App1 https://domain.com/jboss/App2 – jeff Jul 26 '12 at 13:00
  • @jeff Right, but does it actually need to be on the non-`/jboss` path for the actual request to the JBoss server to map to the correct context path for your web application? If it needs to have the path throughout, then make the change recommended in my answer and all should be well, but I'm confused at how the application code is even handling the request at all if an important part of the URL path is completely missing. – Shane Madden Jul 26 '12 at 15:55
  • Not sure how to answer that. I have edited my question to facilitate. – jeff Jul 26 '12 at 17:12
  • @jeff Ahh, then it is indeed an issue with the `ProxyPassReverse`. See the edit to my answer. – Shane Madden Jul 26 '12 at 17:49
  • Shane thanks I really appreciate you helping. But the error in apache never mentions /jboss as in /jbossappname. I was trying to anonymize my path, maybe a bit too much. file not found is more like this /WEB/wwws/appnamelogin.jsp – jeff Jul 26 '12 at 18:13
  • so.. I need clarification, do I change both ProxyPassReverse and ProxyPass? Didn't understand what you meant by "Leaving the above in place". Thanks!!! – jeff Jul 26 '12 at 19:39
  • @jeff What I meant by that is that I was going to leave the old version of the answer there instead of editing it out completely - but that difference in the path changes things. Something doesn't add up - none of this config should be capable of removing the slash from that part of the URL string, in addition to having removed the `/jboss` from the path. Is there any way you can get a more complete picture of the config? Of particular interest is what's going on in the `` section, as well as any other `ProxyPass` or `ProxyPassReverse` settings. – Shane Madden Jul 26 '12 at 20:42