Search code examples
internet-explorer-11http-referer

Internet Explorer drops Referer header when fetching a PDF in chunks


We have a web app that serves PDFs. We see occasional failures for Internet Explorer 11 only. The failure is connected to app logic which is relying on the Referer header. (I know, using the Referer header is not robust.)

The problem occurs when IE tries to fetch a large PDF in chunks. The first chunk is returned OK, and its HTTP request has a Referer header.

The second chunk is not OK. For the second chunk, the Referer header is absent from the HTTP request. This initiates app logic which depends on an absent Referer header, and the download of the PDF fails as a side effect.

Why is the Referer header dropped in the middle of the fetch, and is there anything I can do about it?


Solution

  • We got around the problem by altering the Accept-Ranges header in server HTTP Responses.

    For URLs that end in .pdf, we changed the header to:

    Accept-Ranges: none
    

    This ensures the client doesn't fetch the file in chunks.