7

I have created a ruby on rails application. I am having below scenario

In localhost for getting referrer link i'm using request.env["HTTP_REFERER"] it's working perfectly not giving null.

I have uploaded the code in heroku , but request.env["HTTP_REFERER"] is giving nil , i have checked in heroku logs.

Please provide a suggestion why it's giving nil ? is there any way to get referrer link other than request.env["HTTP_REFERER"] ?

Donny Kurnia
  • 5,260
  • 5
  • 35
  • 52
  • 1
    Some question was in SF. [Please, see this question][1] This help for you? [1]: http://stackoverflow.com/questions/3104711/ruby-on-rails-request-envhttp-referer-returns-nil – Zzet Nov 26 '12 at 22:23
  • I can confirm the behavior of Heroku. However, we have a setup with Play Framework 2.1 / Scala. On localhost it works as designed. Any updates on this question from your side? Did you find a solution by now? – Patrick Hammer Jun 24 '13 at 19:18
  • I think more details about the referer page and the context of the `request.env["HTTP_REFERER"] would be helpful. – sealocal Nov 14 '14 at 08:26

1 Answers1

1

request.env["HTTP_REFERER"] giving nil is acceptable when directly navigating to a page, I suggest to use link_to :back instead or specify where it should go back (link_to root_path).

Alexandre Magro
  • 1,131
  • 2
  • 10
  • 22