Closed GoogleCodeExporter closed 9 years ago
Ahh silly me, oddly enough even though I have headers mod enabled the files
served in gzip did somehow work properly. for the time being I commented the
lines out in the .htaccess
It is odd nonetheless though. I'll have to look a bit more into this ^^
Original comment by element....@gmail.com
on 4 Aug 2013 at 2:28
"the files served in gzip did somehow work properly."
Did you mean "didn't"?
For some reason, the "serve compressed assets" feature worked on Windows, but
not on Linux.
Original comment by asterixvader
on 5 Aug 2013 at 2:48
yes I meant didn't XD
Ahhh interesting, well I used mod deflate anyhow so that should do enough
already.
My first guess was that maybe the two compressions got in the way of each
other... it is possible
Original comment by element....@gmail.com
on 5 Aug 2013 at 2:50
I don't think so. What it does is redirect the request for the non-compressed
asset, and redirect it to serve the compressed one instead, putting the
corresponding headers.
But when I tested on Linux, it didn't work. I don't remember what exactly
wasn't working, if the headers weren't being sent or something else.
Original comment by asterixvader
on 5 Aug 2013 at 2:58
well the headers where sent correctly in my case actually, I saw it saying
content type gzip, but it did not uncompress the file and instead tried to
serve a compressed CSS/JS. Very nice effect.
Well anyhow, if you say this does not work I will believe you :P
Original comment by element....@gmail.com
on 5 Aug 2013 at 3:01
It seems like you were right~ apparently the files were being gzipped twice by
the Deflate mod.
The solution: disable Deflate. How to do so? You only need to set a variable
(SetEnv no-gzip), like this:
<IfModule mod_headers.c>
SetEnv no-gzip
# Serve gzipped stylesheets.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(assets/.*)\.css $1\.css\.gz [L,ENV=ASSETSCSS:true]
Header set Content-Type text/css env=ASSETSCSS
Header set Content-Encoding gzip env=ASSETSCSS
# Serve gzipped javascripts.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(assets/.*)\.js $1\.js\.gz [L,ENV=ASSETSJS:true]
Header set Content-Type text/javascript env=ASSETSJS
Header set Content-Encoding gzip env=ASSETSJS
</IfModule>
However... the difference between file sizes isn't that big. From 15006 with
deflate to 14870 with the actual gzipped file. So these settings would probably
be more useful for servers without the Deflate mod.
Original comment by asterixvader
on 8 Aug 2013 at 6:40
I just had this problem. I'm running on Ubuntu 13.04 with fresh installs of
Apache 2.2.22, PHP 5.4.9, and MySQL 5.5.32.
The problem occurs because my Apache installation had configured mod_deflate.so
(in /etc/apache2/mods-available/deflate.conf) to by default compress text/css,
application/x-javascript, application/javascript, application/ecmascript and
application/rss+xml.
That meant the content was compressed twice, and I think only the browser gets
confused about that, so there is no error on recorded on the server, but you
receive junk files.
I'd suggest either removing the compression statements in .htaccess or telling
people to check how their mod_deflate is configured.
Original comment by TheFirst...@gmail.com
on 18 Aug 2013 at 5:40
If I'm not wrong, Deflate causes a lot of overhead on large files. Disabling it
as shown above, letting Apache serve the already gzipped files, would aliviate
this.
Original comment by asterixvader
on 13 Oct 2013 at 5:02
Original issue reported on code.google.com by
element....@gmail.com
on 4 Aug 2013 at 1:09