Is there a way of disabled byte-range requests in Apache?

I have a web page with a link to a PDF file (target="_blank"). If I click the link, the PDF reader just shows a grey screen within the Firefox browser.

If I copy that link and manually open it in a new tab, the PDF will display correctly, and subsequent requests made by clicking the original link now work, suggesting that the problem occurs when loading the file into the cache.

It appears as though the Adobe PDF reader plugin is making byte-range requests (I see lots of 206 responses) and I suspect that this may be the cause of the issue.

I am running an Apache webserver. Has anyone had problems with Apache and Adobe’s byte-range requests? Are there any workarounds? Perhaps a way of configuring Apache to ignore byte-range requests on PDFs?

Answer

The question how to disable the requests was asked and answered on the httpd mailing list:

How do I disable Accept-Ranges?

Origin servers that accept byte-range requests MAY send

      Accept-Ranges: bytes

  Servers that do not accept any kind of range request for a
  resource MAY send

      Accept-Ranges: none

if you do not find a more direct way, you could always use mod_headers
to remove or change the response headers.

-> see apache documentation for mod_headers for how to set the Accept-Ranges header to none

http://mail-archives.apache.org/mod_mbox/httpd-users/200912.mbox/%3C4B1ECDD4.10403@ice-sa.com%3E

Attribution
Source : Link , Question Author : Sam Minnée , Answer Author : Community

Leave a Comment