This page simply displays the HTTP referer as sent in the HTTP request headers (by the browser / user-agent), as well as your IP address and a bunch of other HTTP request headers.
$_SERVER['HTTP_REFERER']
(PHP)
<Not Set>
document.referrer
(JavaScript)
"<Requires JavaScript>"
(Note that the JavaScript referrer
property has two r
's)
As returned from PHP's apache_request_headers()
function:
Array ( [Host] => w3dk.com [User-Agent] => CCBot/2.0 (https://commoncrawl.org/faq/) [Accept] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [Accept-Language] => en-US,en;q=0.5 [If-Modified-Since] => Mon, 09 Sep 2024 22:21:43 GMT [Accept-Encoding] => br,gzip [X-HTTPS] => 1 )
For completeness, your reported IP address is:
$_SERVER['REMOTE_ADDR']
(PHP) = 35.171.164.77
Reverse lookup on IP address: ec2-35-171-164-77.compute-1.amazonaws.com
This is to test whether URL shortening services pass the referer.
In order to test the HTTP Referer when following a redirect, the following links all redirect back to this page in various ways:
replace()
method) back to this page - Original Referer is lost and set to intermediary (redirect) page. Note that this method uses the window.location.replace()
method, so the intermediary/redirect page is replaced in the browser history.href
property) back to this page - Original Referer is lost and set to intermediary (redirect) page. This method assigns directly to the window.location.href
property, so the intermediary/redirect page is NOT replaced in the browser history.See immediately what HTTP referer is passed when navigating from this non-SSL page. Note that navigating from HTTPS to HTTP the browser blocks the referer for security reasons. Navigating from HTTP to HTTPS there is no such security and the HTTP referer should be passed by the browser.
When clicking on a result in the Google SERPs (HTTPS) and navigating to here (an HTTP page), the HTTP Referer is still set to "https://www.google.co.uk" in most modern browsers (except IE). It is not blank as you might expect. This is probably due to the <meta content="origin" name="referrer">
element in the head
section of the search results page.
In IE11, the HTTP Referer is set to:
http://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwj-o47L883LAhWMF5oKHQ3LA_wQFggjMAA&url=http%3A%2F%2Fw3dk.com%2Fpermalink%2Freferer.php&usg=AFQjCNF4mBtIhIZvnz7vjeQRWdts4WfndA