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

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.

Related

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.

Preventing 200 (Cached) responses

I just deployed a Django app with majority of the front-end code in Javascript files. The problem is, whenever I make an update to my JS files, that is not reflected on if someone opens the page, since they get a '200 (Cached)' response, and are getting the previous version of the Static file. A CTRL-F5 fixes this of course.
What would be the best way to deal with this issue? Where would a problem like this be solved?
Headers in the Django response?
Some Apache config (since the static files are server directly from
Apache)
Something else?
I don't want to go through the route of renaming files after each change, it doesn't seem like a clean solution for me. Any proper technique of achieving this?
One thing that I noticed, the 200 (cached) response that I get has these among the headers:
Expires:Fri, 28 Nov 2014 04:11:29 GMT
Last-Modified:Sun, 28 Sep 2014 19:43:58 GMT
The Last modified infact should be around 29 Sep 2014 09:14 GMT. Could it be something to do with the Expires header? If yes, how should I set expires to, maybe, a day or less in the future? Again, this has to be done via Apache I presume?
NOTE: Performance gain/loss due to caching is absolutely not a concern here.
Take a look at using WhiteNoise or django-compressor to handle this.
Most production deployments of Django minify the CSS/JS at first fetch-time, and name the resultant file using a checksum. That way, the files can be cached forever, since if they're changed, a different filename will result.
Since there are apps available for this already, hopefully this won't cause you too much trouble.

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.

How do I enable gzip compression on a coldfusion at the directory level?

I'm supporting a legacy application on ColdFusion 7, and the pages are full of painful amounts of whitespace that I'd like to gzip away.
I know I can:
manually compress everything in an index type file (reference)
enable it in the web.xml (which I don't have access to)
But can I just throw the right < cfheader > or something akin to a .htaccess that triggers gzipping on this directory?
There are two ways to implement compression. At the web server level (apache 1.3 with mod_gzip or mod_deflate, IIS_6, IIS_7) or the application server level (coldfusion via a servlet filter).
I'm afraid those are the only options available to you for compression.
Otherwise you'll be looking at one or more of these:
enabling whitespace suppression via
cf administrator.
using <cfsetting
enablecfoutputonly="true"/> where
possible.
wrapping code with
<cfprocessingdirective
suppressWhiteSpace="yes"></cfprocessingdirective>
wrapping code with <cfsilent></cfsilent>
The only time I've seen CF handle GZIP itself, IIRC, is when using the internal (not for production) web server. I've always seen compression handled at the webserver (IIS or Apache) level.
If there is specific code that is dumping large amounts of whitespace, there are a number of options for dealing with it. Several are roughed out in an article by Ray Camden.
Personally, I don't worry about whitespace much unless it's really bad. I turn off output in CFCs (if something should be displayed, I return it), and I use CFSilent blocks around code blocks that shouldn't display output anyway.

Any reasons not to gzip documents delivered via HTTP?

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.