In a Spring Controller Action, I am using the following statement to redirect to an external URL:
String redirectUrl = "www.yahoo.com";
return "redirect:" + redirectUrl;
However, it appears that it's redirecting the url locally and not replacing the entire address bar URL with www.yahoo.com.
Ex: With the above redirection, my address bar now looks like:
http://localhost/myApp/auth/www.yahoo.com
How do I resolve this? I even tried redirecting to a view and then having the view redirect the URL, but still the same result. The only way it seems to work is if I have http://www.yahoo.com or https://www.yahoo.com But I wanted it to redirect the URL as specified and not necessarily mention the protocol. Ex: yahoo.com is similiar to http://www.yahoo.com if you go directly in the address bar.
Thanks