I am trying to spoof referrer.
A.com –> B.com –> Destination.com
A.com I have
header("Location: http://B.com/redirect.php?site='http://destination.com'");
B.com I have
$target = $_GET['site'];
header("Location: $target");
Destination.com writes the $_SERVER['HTTP_REFERER']; to a database where I can confirm if the refer spoof worked.
However, database shows that referer is A.com not B.com ! Where did I go wrong ?
Location headers are redirects. You’re telling the browser “What you want isn’t here, go look there instead.”
So, the browser happily submits the same request to the new url.
Of course, being the same request, the referrer sent is unchanged.