I have written a web app in Java/J2EE and am deploying it using apache (ec2 micro instance) to forward requests from port 80 to port 8080 (same machine). My httpd.conf looks like the following:
<VirtualHost *:80> ServerName localhost <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPreserveHost On ProxyPass / http://localhost:8080/WEBAPP/ ProxyPassReverse / http://localhost:8080/WEBAPP/ </VirtualHost>
The problem is that when I prepend
<%=request.getContextPath()%> before my resources (urls, image path, js files, etc.) it prepends the same thing when I access my app from port 80 or 8080. Now when I access my app from port 80 all of my links are messed up and none of my JS, css, or urls work.
Also, I could be approaching setting up my web app entirely wrong so any advice to better set this up would be appreciated.
Asked this on stack overflow but was pointed here...
As mentioned in a comment below I am setting up a domain name and would like mydomain.com to load mydomain.com:8080/WEBAPP when I access mydomain.com. I'm not sure redirect is the correct answer because I don't want to just send the user to mydomain.com/WEBAPP (which is an easy fix) I want the URL to look nice and act intuitively, not just redirect the user everywhere. Also I'm trying to avoid using relative paths while access my resources (imgs, css, js, etc.) so that I can forward/redirect users from a servlet or access the jsp directly and the paths to be correct regardless of what is actually showing in the URL.
Hope that is a bit of a better explanation. Sorry again if I was not clear above.