2

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?

3
3

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:

  1. Webpage-X contains "my-shortener-link" (that is on Domain-A)
  2. User clicks on "my-shortener-link" and the browser sends a request to Domain-A. The browser sets Webpage-X as the Referer.
  3. Domain-A returns a 3xx redirect response to the browser with a Location header pointing to bit.ly.
  4. The browser sends a request to bit.ly, again setting Webpage-X as the Referer, since it remembers that Webpage-X started this process to begin with.
  5. bit.ly returns a 3xx redirect response to the browser with a Location header pointing to the target-URL.
  6. 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.

2
  • That's what I wanted to know if (1) my shortener link could be exposed somehow along the way... Thanks a lot!
    – Tony
    Nov 18 '20 at 10:55
  • You're welcome. If this answered your question then please mark it as "accepted". Thanks, much appreciated. :)
    – MrWhite
    Jan 15 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.