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...