My old way using mod_jk in apache and configure virtual host in tomcat In the JSP file, I refer to CSS as below
/
<%=request.getContextPath()%>/css/styles.css
while the home link is set to
/<%=request.getContextPath()%>/
so this worked fine when I use mod_jk in apache to work with tomcat using ajp;
- When I try to configure reverse proxy as below
ProxyPass / http://localhost:800/mywebapp
ProxyPassReverse / http://localhost:800/mywebapp
the home page can be retrieved fine but the css request becomes http://mydomain.com/mywebapp/mywebapp/css/style.css so the css file can not be retrieved correctly;
- I think one possible way is to always use relative path like ./style.css or ../style.css a. since header/footer are shared, and the home page is in a different level with detail page, it's inconvenient to use relative path because they're at a different level b. still, I think the home link will have to be /<%=request.getContextPath()%>/
so I wonder what's the way to set contextroot fine in java web and also work fine with reverse proxy?
thx a lot