0

I am running a spring framework based web app on Oracle Weblogic Server. I have 2 subdomain for my URL pointing to my application (Instance).

For example: www.asd.com and secure.asd.com.

From my code I need to identify the subdomain and handle different logics for each subdomain.

((HttpServletRequest) request).getRequestURL().toString();

is actually returning machine name instead of full URL.

My expectation

secure.asd.com

But what I'm getting is (machine name)

svmachine001

Any idea how to get Full URL?

2
  • The request URL is taken from the URL you used at the client. You must have used svmachine001. Solution: don't. Commented Jul 27, 2023 at 2:01
  • Are you using a reverse proxy like nginx? Commented Jul 27, 2023 at 4:08

1 Answer 1

0

Did you try getRequestURL()? Here is called from a servlet:

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
...
        StringBuffer requestURL = request.getRequestURL();
...
}

Tested in WLS 12.2.1.4.

Taken from: How can I get the request URL from a Java Filter?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.