Re: Re: Problems with GZIPped content in some cases?!?
| From: | Jochem Maas | Date: | Tue, 31 Jan 2006 15:56:41 +0000 |
| Subject: | Re: Re: Problems with GZIPped content in some cases?!? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229563@lists.php.net to get a copy of this message | ||
Olaf Greve wrote:
Hi Barry (and others), Thanks for your answer!ouch :-) I just wante to butt in and mention that there is also the following conf stuff for apache (apache2) which will make your stuff zipped with borking badly written browsers (i.e. IE ;-):This is surely a browser problem.I already feared as much... The nasty thing is that due to this some of the end users of our client are losing confidence in the way the application works. Disabling GZIP is not really what I want to do either, as some pages alone comprise about 1MB (!) of pure HTML...:D
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 SetEnvIfNoCase Request_URI \/image\.php no-gzip dont-vary# Also don't compress PDF and Flash-files 17-01-2004 MM
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.swf$ no-gzip dont-vary# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-varyjust stick it in your httpd.conf or vhost definition and behold the transparent gzipping whenever it's possible! (all thanks to the apache gurus of course).
However... I have of course also been RTFM-ing a good bit, and I'm now trying the far simpler per page override of the output buffer by using the following function call: ob_start("ob_gzhandler"); This seems to enforce GZIP compression correctly (I've performed a socket call and analysed the headers and data, and it is GZIPped alright, and the header for GZIP compression is set as well), so I have just informed our client that I would like them to test it again. I will keep the list posted as well to let you know if it works correctly now or not... Cheers, Olafo