Java Mailing List Archive

http://www.apache-httpd.com/

Home » users.httpd »

[users@httpd] htaccess and httpd.conf precedence (mod_deflate)

Joost Schuttelaar

2010-06-01

Replies: Find Java Web Hosting

Author LoginPost Reply
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 file:

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...

Thanks!

--

Joost Schuttelaar
The Hague, NL


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@(protected)
 "  from the digest: users-digest-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.