Posted over 8 years ago. Visible to the public.

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 where they all behave the same.

PD: the right spelling in english is referrer. However the internet misspelling has become more popular. Archive

Owner of this card:

Last edit:
about 7 years ago
by dncrht
Posted by dncrht to HouseTrip Deck
This website uses short-lived cookies to improve usability.
Accept or learn more