Redirect to a servlet when using a proxy
843833Aug 16 2001 — edited Aug 17 2001Hello,
How can I redirect to a servlet from a jsp without hardcoding any directory/parts of the url?
I am using tomcat v.3.2.1.
The webapp is behind a proxy server and that address can change so when the real url to a jsp called myjsp.jsp would be something like "www.host.com/webapp/myjsp.jsp", it is now proxied to something like "www.otherhost.com/somenicedir/otherdir/webapp/myjsp.jsp" now the proxy part ("www.otherhost.com/somenicedir/otherdir") can change and I need to know how to redirect from a jsp to a servlet without hardcoding the proxy part.
If I redirect from a jsp to a jsp I can just do it with sendRedirect("otherjsp.jsp") since it is in the same folder. But for a servlet, since it is in a different folder the redirect would be something like sendRedirect("/servlet/myServlet") but when I send that with a proxy, it goes to "www.otherhost.com/webapp/myjsp.jsp" and then it gives you error page not found since it is missing the dirs in between.
So how do I make a clean redirect from a jsp to a servlet inside the same webapp without it getting redirected to some wrong address if its proxied?
-teka