Any reasons not to gzip documents delivered via HTTP? - compression

I remember someone telling me that gzipped content is not cached on some browsers?
is this true?
Are there any other reasons why I shouldn't gzip my content (pages, javascript and css files) with htaccess?

The other reason is it obviously increase CPU load, but whether this is a problem depends on your content type and your traffic.
If you are going to use GZip from with .htaccess, be sure to wrap it in a condition whereby it only executed of the mod_gzip module exists, this will make the site / app more portable if moving it to another server.
If you opt to use .htaccess GZipped content the browser will receive compressed content if it supports it, or received the normal uncompressed version if it doesn't

If you are delivering mostly .gz files, then obviously you don't want to gzip them. Otherwise it's probably a good idea, especially for cache-able content. I have never heard of caches not working with gzipped content.

I think you need to handle both GZipped and not gzipped data since IE6 and GZipping do not live together nicely.
Otherwise I cant think of an issue

If you need to stream the content of a page, or want to use Response.Flush, then you can't use compression/gzip.

Related

How to enable gzip compression instead of brotli compression on OLS + DA?

I'm using Litespeed plugin for wordpress (From LiteSpeed Technologies), with a litespeed server, and despite what I do, it is not compressing javascript and css, and there's no option in the plugin for setting up "js & css" by the way. I already tried using other plugins, so I don't think the problem is the plugin, it's something in my server. I tried editing the following files usr/local/lsws/conf/httpd-tuning.conf and /usr/local/directadmin/custombuild/configure/openlitespeed/conf/httpd-tuning.conf
Changed the compression level, and yet I can't put this thing to compress. Yes, it is working, but it's only compressing text and html.
Even after changing the headers in the files from text/*, application/x-javascript, application/xml, application/javascript, image/svg+xml,application/rss+x$
to
text/*, application/x-javascript, application/xml, application/javascript, text/html, text/css, text/plain, text/xml, text/x-js, text/js, text/javascript
it still will not work.
Yes, I restart lightspeed every time I make changes, I can even see from the litespeed server administration that the new headers were applied. I believe it might be something else. I saw someone saying he said the same problem and his problem was the wildcard (besides the headers), but I don't know what that means.
For OLS, you can either enable gzip or brotli compression. Please refer to https://openlitespeed.org/kb/using-gzip-brotli-compression/. Since you are using OLS on DirectAdmin, you have no ability to modify the value by logging in to OLS admin console(That's because DA's implenmatation of splitting conf files, you will need to modify the server level or virtual host level directly by adding directive(brStaticCompressLevel 0) there. By the way, question title is better to change to: (not about caching at all, it is about )"How to enable gzip compression instead of brotli compression on OLS + DA" to avoid confusing.

TYPO3 compression only works on js/css, not on html file itself

I'm trying to optimize the pagespeed and trying to figure out what does what.
I've managed to merge and compress js/css files, so Google Pagespeed doesn't bother me with that anymore.
Now I still get the message that I can save some bytes by compressing "http://yourpage.com/" which basically means that the html/php-file itself is not compressed (I think)
Any idea how I can solve this?
Some additional information:
Using TYPO3 6.2.21 with the default .htaccess file enabled.
there is an extension for that: https://typo3.org/extensions/repository/view/sourceopt
That works very well. I use it in many projects.
Apparently I had to remove the '<IfModule mod_filter.c>' condition from my .htaccess file, now it's working. I read that my Apache version might be too old.

When will NSURLConnection decompress a compressed resource?

I've read how NSURLConnection will automatically decompress a compressed (zipped) resource, however I can not find Apple documentation or official word anywhere that specifies the logic that defines when this decompression occurs. I'm also curious to know how this would relate to streamed data.
The Problem
I have a server that streams files to my app using a chunked encoding, I believe. This is a WCF service. Incidentally, we're going with streaming because it should alleviate server load during high use and also because our files are going to be very large (100's of MB). The files could be compressed or uncompressed. I think in my case because we're streaming the data, the Content-Encoding header is not available, nor is Content-Length. I only see "Transfer-Encoding" = Identity in my response.
I am using the AFNetworking library to write these files to disk with AFHTTPRequestOperation's inputStream and outputStream. I have also tried using AFDownloadRequestOperation as well with similar results.
Now, the AFNetworking docs state that compressed files will automatically be decompressed (via NSURLConnection, I believe) after download and this is not happening. I write them to my documents directory, with no problems. Yet they are still zipped. I can unzip them manually, as well. So the file is not corrupted. Do they not auto-unzip because I'm streaming the data and because Content-Encoding is not specified?
What I'd like to know:
Why are my compressed files not decompressing automatically? Is it because of streaming? I know I could use another library to decompress afterward, but I'd like to avoid that if possible.
When exactly does NSURLConnection know when to decompress a downloaded file, automatically? I can't find this in the docs anywhere. Is this tied to a header value?
Any help would be greatly appreciated.
NSURLConnection will decompress automatically when the appropriate Content-Encoding (e.g. gzip) is available in the response header. That's down to your server to arrange.

Is there any compression available in libcurl

I need to transfer a huge file from local machine to remote machine using libcurl with C++. Is there any compression option available in-built with libcurl. As the data to be transferred is large (100 MB to 1 GB in size), it would be better if we have any such options available in libcurl itself. I know we can compress the data and send it via libcurl. But just want to know is there any better way of doing so.
Note: In my case, many client machines transfer such huge data to remote server at regular interval of time.
thanks,
Prabu
According to curl_setopt() and options CURLOPT_ENCODING, you may specify:
The contents of the "Accept-Encoding: " header. This enables decoding
of the response. Supported encodings are "identity", "deflate", and
"gzip". If an empty string, "", is set, a header containing all
supported encoding types is sent.
Here are some examples (just hit search in your browser and type in compression), but I don't know hot exactly does it work and whether it expect already gzipped data.
You still may use gzcompress() and send compressed chunks on your own (and I would do the task this way... you'll have better control on what's actually going on and you'll be able to change used algorithms).
You need to send your file with zlib compression by yourself. And perhaps there are some modification needed on the server-side.

How can I compress my .php site with zlib and zpipe.c

I am having a problem compressing my website. My host (www.one.com) does not support gzip, so I contacted them regarding any other way to compress my site. First I talked to a supporter that told me that it could not be done, since their server is set up with zlib. So i googled zlib, and there where some tips regarding this problem.
I tried adding:
php_flag zlib.output_compression on
php_value zlib.output_compression_level 5
to my .htaccess file, witch caused the browser to render: "internal server error".
Then I tried talking to them again, and this time I was pointed to this site: http://www.zlib.net/zlib_how.html
The problem is that I have not come across neither zlib nor zpipe.c before. I have tried to google it, and look around different forums, but I do not get it.
Can anyone give me some pointers on how to get this to work? How do I implement zpipe.c? I am a complete noob here, so I would appreciate a step by step guide.
My site is writen in .php
This is how i did it and i am using one.com as hosting company.
I added this line into my index file:
<?php
ini_set("zlib.output_compression", "On");
ini_set("zlib.output_compression_level", "-1");
?>
This added compression on my whole site :) myvotebooth.com
And then i added this into my .htaccess file
<IfModule mod_deflate.c>
<FilesMatch "\.(js|css|html)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
By doing this i get a response header:
Web page compressed? Yes
Compression type? gzip
Size, Markup (bytes) 11,329
Size, Compressed (bytes) 3,187
Compression % 71.9
I also tried to compress even more -2 -3 -4 -5 but one.com only allow -1
First I talked to a supporter that told me that it could not be done,
since their server is set up with zlib.
It sounds to me like they don't know what they're talking about. What http server are you using? Apache? Whatever it is, it should support pre-compression of your html using either the gzip or "deflate" content encoding. You need to find someone who supports your server that knows that they're talking about.
zlib is a library of compression routines that can compress to either the gzip or "deflate" content encoding.
The reason I keep putting deflate in quotes is that the HTTP standard calls the zlib format "deflate". It is sometimes confused with raw deflate, and is the reason you should always use gzip for http delivery since there is no ambiguity in that case.
Update:
Since you are using Apache, you can probably get this working without the help of your hosting company. You can put Apache directives to mod_deflate your .htaccess file. Here is an example.