Odd referrer issue

The request referrer is the URL you come from. It's set by the browser when you click a link (all browsers) and in Javascript click events too (all but the Internet Explorer family).

If you click a link on a page:

request.referer == request.referrer == request.env['HTTP_REFERER']

So far so good. But if you write the URL straight into the browser:

request.referer == request.env['HTTP_REFERER'] == nil


request.referrer == '/'

instead of nil.

This seems to happen in our current version of Rails, although not in Rails >= 3.x...

This website uses short-lived cookies to improve usability.
Accept or learn more