I 301-redirect a link to track a click.
http://myurl.tld/redirect.php?target=http%3A%2F%2Ftarget.tld%2Ffile.pdf
I track the amount of calls and some other stats on redirect.php
. It works well unless I redirect to a pdf file in Internet Explorer (I tested v11, might affect other versions).
In this case, redirect.php
tracks dozens of clicks within a few seconds made by the same user.
Using fiddler I found out that the pdf is returned in chunks (HTTP status code 206 Partial Content
) which means several requests are made instead of a single one.
Normally, you would expect the browser to make the subsequent calls to http://target.tld/file.pdf
when target.tld
delivers the pdf in chunks and this is exactly what most browsers do.
However, Internet Explorer decides to request http://myurl.tld/redirect.php?target=http%3A%2F%2Ftarget.tld%2Ffile.pdf
again and again and again instead of requesting the target site.
Now my questions:
How can I tell IE not to call myurl.tld
but instead target.tld
?
Can I manipulate the headers in the 301-redirect, so that IE knows to request the file from target.tld
?