Take the 2-minute tour ×

I am using Ruby on Rails (3.2.2) and I would like to retrieve the value of the URL from where a request is performed. That is, given I am on the http://stackoverflow.com/questions/10147789 Web page and in that page content there is an link having a URL to my application at http://my_application.com, when I access that URL I would like to retrieve the http://stackoverflow.com/questions/10147789 string.

Is it possible? If so, how?

share|improve this question
You might try request.referer within your controller. But not sure yet, not on my machine yet. –  Deradon Apr 13 '12 at 20:28
add comment

1 Answer

up vote 2 down vote accepted

Yes, it is. You can use HTTP_REFERER

share|improve this answer
BTW: Is the request.referer string always "set"/"generated" and available for any request performed from any source? –  user12882 Apr 13 '12 at 21:08
add comment

Your Answer


