I have a JSP page at an address like this:
When I output request.getRequestURL(), I get something totally different:
Note the domain changed to an IP and /foo/bar is missing. How do I get the true URL that the browser requested using JSP?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This can happen if there is a proxy (such as Apache HTTPD) in front of the Java EE server. The particular proxy could (should) have set the original request URL as a request header. At least, all self-respected proxies do that.
You can crawl through all request headers as follows to find it out: