[Logo]
Forums Register Login
Redirecting back to the URL from where the user came
Hello,

I want to get path info that from which URL user came to sign in to our page as to redirect back after successful sign in but there is problem how can I check that this URL is related to our website URL or not.

Is there any technique to check that if the user came from www.myDomain.com/* then redirect him back else forward homepage

Thanks & best regards
Have you tried using request.getRemoteHost() method to know from where the request is coming.

- Kamlesh
http://en.wikipedia.org/wiki/HTTP_referrer

That's the way to go.
When you get to the sign-in screen you can try the Referer header (that's right Referer, not Referrer):

It isn't always set, but if it is it should point to the last page the user was at before getting sent to the sign in form. Then you can either store the value in the user's session or add it as a hidden field to the sign in form.

The remote host header gives information about the client (IP address or host name) not the URL to the last page before the sign-in.
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss


This thread has been viewed 942 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 17, 2018 15:35:22.