0

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?

Sam Minnée
  • 143
  • 1
  • 5

3 Answers3

2

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

0

Do you have Squid sitting in the middle? It's a common problem with the Adobe plugin - it attempts to fetch the end of the PDF (the TOC), Squid starts downloading the entire file, Adobe times out and presents a blank page.

Teach yourself to "right-click, save-as" instead - a PDF is not a web document and shouldn't be viewed in a browser.

Andrew
  • 7,772
  • 3
  • 34
  • 43
  • Unfortunately the right-click solution isn't really workable because I'm building an app for a bunch of other people. Thanks for the tip about a proxy, though, I'll check it out. Is there any way of configuring Apache to ignore byte-range requests? – Sam Minnée Jun 16 '10 at 07:29
  • BrowserMatch .* downgrade-1.0 – user6738237482 Jun 17 '10 at 03:53
0

This problem was sometimes producing Error 109 in Acrobat Reader when viewing a PDF.

To disable Byte-range requests via htaccess file:

# Disable Byte-range for PDF files
<Files *.pdf>
    Header set Accept-Ranges none 
</Files>