httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <>
Subject Re: [users@httpd] htaccess and httpd.conf precedence (mod_deflate)
Date Tue, 01 Jun 2010 19:37:11 GMT
On Tue, Jun 1, 2010 at 12:12 PM, Joost Schuttelaar
<> wrote:
> Hi everybody,
> I'm running a Apache installation using a standard DirectAdmin setup, but I'm having
problems with handling of gzipped output.
> One of my PHP scripts outputs a .ZIP file (with appropriate headers). By default, the
output of this script gets gzipped by mod_deflate. Of course there is no need to gzip a zip
file, but decent browsers have no problem handling this. Internet Explorer mangles the file
though, unless you set a non standard content type.
> So, in order to fix this and disable gzip for this script, I've set up a line in my .htaccess
> SetEnvIf Request_URI download_file\.php$ no-gzip dont-vary
> When I test this using wget (wget --header="Accept-Encoding: gzip,deflate") this works
fine. Output from this script does not get gzipped. However, if I add the IE user agent header
(User-Agent: Mozilla/4.0 (compatible; MSIE 6.0;.....) the content still gets gzipped.
> Strangely, when I replace the above line with 'SetEnv no-gzip', the content does not
get gzipped even though I send the IE user agent header. I've traced this back to the stock
httpd-deflate.conf which is included in my httpd.conf. It contains the following line:
> BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
> When I comment this line out, things work as expected... does, for some reason, a BrowserMatch
reffered from httpd.conf have precedence over what's in a .htaccess file? Any suggestions?
I could change my httpd.conf, but when the site for instance gets moved to a different server
this problem might rear it's ugly head again...

two pieces of trivia that might fill in some blanks:

1) SetEnv runs much later than SetEnvIf/BrowserMatch no matter what
context you place it in

2)  somewhat counterintuitively, <Location has precedence over
<Directory  -- perhaps you could wrap the canned deflate stuff in a
<Directory> entry at a higher then your htaccess so the htaccess is
processed second?

Eric Covener

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