I'm trying to capture the last page in my app that a user was on as part of the Rails req/res cycle. I know that I can look into the request itself using request.headers["HTTP_REFERER"]
and that spits the most recent url back at me. All is good.
My concern is regarding situations where there is a redirection. As in person clicks link, gets redirected silently and then ends up on the destination page. In such a situation is the value of HTTP_REFERER
going to be the original page that they were on, or is it going to be the URL of the most recent redirection? I'm assuming that it's the latter case as the browser is making an entirely new request but I can't find a definitive answer. If it is the case, is there any way to find the original referring page or is that data just lost when the new (redirection) request is made?
Apologies for my ignorance, my understanding of the Rails request response cycle is rather limited.