httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bing Du" <>
Subject Re: [users@httpd] I'm worried...
Date Tue, 29 Aug 2006 16:47:36 GMT
> Hi,
> I use Apache2 on Mandrake 10.1.
> I installed it recently. I build a simple web site which allows to
> download
> tips as PDF Files.
> I created the original PDF Files on my computer. I can read them with no
> problem.
> I transfered them to my website, first using Samba.
> I notice then that some files could not be correctly read : IE tells me
> (or
> rather Adobe Acrobat plugin) that "The file does not start with '%PDF-'" !
> I
> did the test on severeal computers...
> Ok, I thought the files were corrupted. I transferted them again but with
> ftp... same problem !
> I decided to transfert somewhere else the files on the same server, then I
> compared (using diff) each "bad" file with the new copy : no difference
> !!!
> For heaven sake, what's wrong !! Argh !!!
> Thanks for your support !

I don't think anything wrong with the PDF files themselves.  The problem
is they got compressed when they are transfered from the web server to the
browser.  Some browsers don't like it and hence the "The file does not
start with '%PDF-'"  error.  Google can tell more about that error.  We've
ever had that problem.  If the module is loaded in your
httpd configuration file, you can turn of compression for PDF files.  The
following config works for us.

# Turn on compression
<Location />
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Or pdf
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary



The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message