I would like to save the url that user visited right before landing to my site. How should I do it in Rails?
I tried
request.env["HTTP_REFERER"]
but couldn't retrieve the previous url.
May be this is a wrong way to test it, but here is what I did:
- I go to a page, say, google.com
- Then I type in: localhost:3000. Then has debugger on to catch request.env["HTTP_REFERER"]. But it yields nil
Is HTTP_REFERER only available when user comes to my site via a redirect, and not manually type it the address?
Thank you.