Forum Moderators: phranque

Message Too Old, No Replies

mod_deflate, pdf and no extension

         

dabe

9:45 am on May 19, 2004 (gmt 0)

10+ Year Member



Hi,
I have a servlet who permit to downwload various files from a database. Before activating the compression in Apache 2 server, it works fine. After there are problem with some pdf files : they don't open in the navigator. i would like to avoid the pdf compression. The "httpd.conf" file looks like this :
...
LoadModule deflate_module modules/mod_deflate.so
...
<Location />
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E]!no-gzip!gzip-only-text/html
BrowserMatch \bMSI[E]!no-gzip!gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif¦jpe?g¦png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</Location>
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '%h %l %u %t (%{content-type}o) "%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate.log deflate
...

I think the problem is that there is no extension ".pdf" in the URI. Is it possible to test the content-type of the header in a "SetEnvIfNoCase" command? another idea?
Thanks,
Annie

dabe

3:10 pm on Jun 2, 2004 (gmt 0)

10+ Year Member



is my question incomprehensible? In this case sorry for my bad english!

jdMorgan

3:57 pm on Jun 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi dabe,

No, your problem is fairly well-described, but the subject area is one where few webmasters have ventured -- Few are using compression, although the number is bound to grow over time.

I have no idea how the server, browser, and Adobe Reader will interact with compressed content, so all I can do is to say Welcome to WebmasterWorld [webmasterworld.com]! and hope that this post will bump your thread up on the active list so it gets a few eyeballs.

Jim

gergoe

9:51 am on Jun 3, 2004 (gmt 0)

10+ Year Member



There's no way to check the content-type of the response.
How do you mean that the pdf extension is not in the url when requesting a pdf file? Are you serving it from a script?
And what's the exact problem with the pdfs? They won't open just like that or you've got some eror message also?

dabe

8:11 am on Jun 7, 2004 (gmt 0)

10+ Year Member



Hi,

First thanks for your answers.
The pdf comes from a servlet. the url looks like this :
[portaltest.example.com...]
(this link don't work, it is factice)

The file is compressed by the apache server, with mozilla
a message says that the file is corrupted, with ie 5.5 it do not open. I read on the net that pdf must not be compressed ( for example : [evolt.org...]
When i download a pdf file directly (http://portaltest.example.com/file.pdf) there is no problem, the file is not compressed.

So my problem is to avoid the compression of pdf.

Annie

[edited by: jdMorgan at 3:24 pm (utc) on June 7, 2004]
[edit reason] Obscured domain name [/edit]

gergoe

6:22 pm on Jun 7, 2004 (gmt 0)

10+ Year Member



Does any of the passed values contains the pdf extension?

Is it possible to make a list from one of the passed parameters which are referring to a pdf file? (With mod_rewrite you can access this list and rewrite the url someway, which later can be recognised by SetEnvIf. Or if the SetEnvIf comes later into the processing than mod_rewrite then you can try to set the enviromental variable with mod_rewrite so the mod_deflate will ignore the compression)

dabe

8:17 am on Jun 8, 2004 (gmt 0)

10+ Year Member



Hi,

The passed values does not contain the pdf extension, there is only the key of the file in the database. The file can be a pdf or a doc.
For the moment i use "SetEnvIfNoCase" to avoid the compression of all the files delivered by this servlet :
"SetEnvIfNoCase Request_URI FileServer no-gzip dont-vary".

Does someone know if mod_gzip works in the same manner?

Annie

gergoe

12:49 pm on Jun 8, 2004 (gmt 0)

10+ Year Member



I think the problem is related to the compression, not to mod_deflate, so I expect the same problem with other compression related modules also. But maybe I'm wrong and it will be working