Problem:
While redirecting user from http://sample.com to http://example.com via header('Location: http://example.com')
- $_SERVER['HTTP_REFERER'];
is empty.
Even after setting referer via header('Referer: http://sample.com')
and then redirecting via header('Location: http://example.com')
- $_SERVER['HTTP_REFERER'];
is still empty.
Expected outcome:
http://example.com receives $_SERVER['HTTP_REFERER']
with appropriate referrer on redirection via header('Location: http://example.com')
Use case
- User receives unique invite link via email pointing to http://sample.com
- User clicks link and is redirected to http://sample.com/?i=123456
- http://sample.com validate invite and if it's still valid(i.e. unused) redirects user to http://example.com/?i=123456
- http://example.com does not have ability to validate invitation, thus it's important to know if user was redirected from the right source
Other:
- behavior is correct if user cliks a link on http://sample.com
- behavior is correct if user is redirected via javascript `window.location="http://example.com"
- $_GET is not an option as it can be very easily forged since http://example.com can't validate invitation