Double redirect - referrer in headers
let's say we have redirects like this:
(1) my shortener link -> (2) bit.ly -> (3) target URL
Is it possible to check on the end (3) that user visit came from (1) my shortened link?
Is it possible to check on the end (3) that user visit came from (1) my shortened link?
No, because "(1) my shortened link" is not the referrer. The web page that contains "(1) my shortened link" is the referrer and it's this that is potentially*1 passed down the line by the browser.
For example:
- Webpage-X contains "my-shortener-link" (that is on Domain-A)
- User clicks on "my-shortener-link" and the browser sends a request to Domain-A. The browser sets Webpage-X as the
Referer. - Domain-A returns a 3xx redirect response to the browser with a
Locationheader pointing tobit.ly. - The browser sends a request to
bit.ly, again setting Webpage-X as theReferer, since it remembers that Webpage-X started this process to begin with. bit.lyreturns a 3xx redirect response to the browser with aLocationheader pointing to the target-URL.- The browser sends a request to the target-URL, again setting Webpage-X as the
Referer, since it remembers...
The server at target-URL only knows (potentially) that the request originated from Webpage-X that contained the original link. It does not know the nature of that link or the fact that several redirects occurred on the way to get there.
*1 I say potentially, since the Referrer-Policy at any redirect along the way could restrict how much of the referrer (Referer header) gets passed on by the browser.
Comments
Post a Comment