I have enabled GZIP in cPanel (Software > Optimize Website). It's set to "Compress All Content". GTmetrix speed test reports that one CSS file is not being compressed:
https://www.swphotovideo.com.au/wp-content/cache/min/1/2affb9ab843ac1d569fdadbf67636031.css
Any idea why this might? It's quite large (1mb~) so I'd like to sort it out. GZIP seems to be working for everything else, but this file.
We use GZIP to compress files so that Websites speed will become fast. As your problem shows you are able to compress all other files but not able to compress "CSS" files.
First of all, you should check your .htaccess file and check whether "TEXT/CSS" is there under "mod_deflate" or not.
# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
# END GZIP
Also, to speed up your WordPress website you can use mod_expires to have Browser cache in WordPress which will speed up your website.
You can refer this article to speed up your WordPress application.
https://hoststud.com/resources/tips-to-leverage-browser-caching-in-wordpress.156/
Or, you should ask your hosting provider regarding this issue.
Related
In several nginx tutorial sites explaining "how to set up gzip compression," I've seen this list of MIME types repeated:
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
However, I immediately found that this list did not result in compression being enabled for JavaScript in Chromium. I had to add application/javascript to the list. Which leads me to believe this list is outdated.
Is there a definitive list of all the content types I would want to gzip?
There is no definitive list of the file types you would want to gzip. Any file type readable as plain text (i.e. non-binary files) are able to be gzipped, and so a "definitive" list would be massive. Therefore, it ultimately depends on which file types you are actually serving, which you can check for any given file via the HTTP Content-Type header.
If you want to be doubly sure you are covering all possible MIME types for a particular extension (which I think is reasonable), Looking at this SO post, this text file contains a pretty darn exhaustive list.
It's important to note that some binary file types like .png and .pdf (even .woff) incorporate compression into the format itself and as such should not be gzipped (because doing so could produce a compressed file larger than the original). My rule of thumb is: if my code editor can't read the file as UTF-8 text, gzipping the file would not be wise (or at least it wouldn't be very efficient).
FWIW, I typically gzip the following formats (in my Apache .htaccess) on my site:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/xml text/css text/javascript application/javascript application/x-javascript application/json application/xml image/svg+xml
</IfModule>
I have a Unity project compiled to WebGL I need integrate in a Meteor application but I'm getting a weird error.
I have placed all unity files inside the public folder in Meteor, but the console reports this error:
Invoking error handler due to
Uncaught SyntaxError: Unexpected token <
blob:http%3A//localhost%3A3000/2fc31e16-9294-484a-8f82-90046929515b:1 Uncaught SyntaxError: Unexpected token <
blob: protocol suppose to be a reference to an internal or in memory resource, but I don't know why, Meteor respond that petition.
If I place the files on an Apache webserver I get no error, even using the same browser, so I think there is no problem with the web gl version of the project.
In the Apache version, if I put the blob:/http... url in another tab I see a lot of JavaScript code, but in Meteor I get HTML meteor code.
Any ideas?
sorry its late but it may help others in future. Currently when you create WebGL build its create a folder named as Release with some compressed files which are gzip files. So decompress these files using Winzip and put that on your server. As you are decompressing these files so definitely their size increases, and its a bad idea if your server serves large files definitely it will take huge amount of time to download so in this case you have to enable gz-compression on your server. How to do it? you can do it by using .htaccess file add this code inside your .htaccess file
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/octet-stream
# For Olders Browsers Which Can't Handle Compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
now your server serves compress file
so that's it any help leave a comment :)
I have a problem with the inclusion of compression on my website. Site hosted with WordPress and GZIP compression of HTML works fine even without any lines in the .htaccess or plug-ins. But the compression of JS/CSS does not turn on. Ive tried a lot of different codes, such as:
<IfModule mod_deflate.c>
<FilesMatch "\.(html|php|txt|xml|js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
or
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
or
# compress all text and html:
AddOutputFilterByType DEFLATE text/css application/javascript
or
# Or, compress certain file types by extension:
<Files *.css>
SetOutputFilter DEFLATE
</Files>
<Files *.js>
SetOutputFilter DEFLATE
</Files>
or even in my header.php:
<?php ob_start("ob_gzhandler"); ?> //result - site crahes
and many others....
Communicated with the server administrator, included more apache modificators: mod_headers, mod_filter and mod_expires, but compression still does not work. I can not understand why??? And how compression of HTML works???
Some of my server's phpinfo():
PHP Version 5.3.3-7+squeeze14
Apache Version Apache/2.2.16 (Debian)
Loaded Modules mod_deflate mod_expires mod_filter mod_headers mod_include mod_mime mod_rewrite etc...
HTTP_ACCEPT_ENCODING gzip,deflate,sdch
Accept-Encoding gzip,deflate,sdch
I've tried to use a lot of WP plugins, such as: W3 Total Cache, Force GZIP, WP HTTP compression, etc... And... Nothing!
Then I've tried to compress files manually: style.css -> style.css.gz -rename-> style.css -load to ftp and replace original. Google's PageSpeed says "Great! Compression enabled! Here is your speed points", but my browser says "Where is my style.css and what kind of cr*p is this?" - because response with style.css has no "encoded gsip" header.
Thanks for advise!!!
The solution is quite simple. Problem is in apache configuration: AllowOverride directive.
AllowOverride None
must be changed to:
AllowOverride AuthConfig FileInfo
or just
AllowOverride All
Then, if you want to optimize browser cache
leverage browser caching
and set ExpiresActive on, config your HTTPD.conf to:
AllowOverride AuthConfig FileInfo Indexes
or just
AllowOverride All
The question is, will the hosting administrator account change the settings.....
I'm trying to improve page speed on a site and using "Yslow" and "Page Speed" to monitor the speeds. I am being told by both to "compress components with gzip" and given a listing of a number of CSS and JavaScript files, for example
/css/styles.css?v=6.5.5
/jquery.flexslider.js
/4878.js
/6610.js
/homepage.css?v=6.5.5
Our hosting have informed us that nginx is doing the gzip compression on ALL assets, even if it reverse proxies back to Apache and the folllowing values from the nginx site-enable files, which is enabled at a virtual host level, confirms this:
gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 9;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
Is there a reason these tools are not picking up by the compression or is it in fact they are not being compressed at all and we need to get our hosting to add something extra?
your hosting provider claims that the requests leave nginx compressed that leaves as potential problem causes:
there's a proxy/cache/virusscanner somewhere on the network path between the nginx server and your client that strips out the compression.
your browser saves an uncompressed version of the asset, and yslow/pagespeed ends up using that (if so make sure you trying it with an empty browser-cache should fix it)
you're hosting provider's claim is false (but the posted config bit seems ok to me )
the problem could be a proxy or cache inbetween the nginx server and your browser that strips out the compression.
Some things to try:
Try checking the url's with on online checker for gzip like http://www.whatsmyip.org/http-compression-test/ or http://www.dnsqueries.com/en/check_http_gzip.php
check locally what the result of curl --compressed --head <your-asset-url> is (you should see a Content-Type: gzip if the response coming in is compressed)
Instead of relying on the server to gizip compress css and js file, is it a good/bad idea to gzip the file, store these on the server and link to those files in the html.
Instead of
<script src="../Scripts/compiled.js"></script>
Have this:
<script src="../Scripts/compiled.js.gzip"></script>
And same with CSS?
I tried but it's not working; the files don't seem to decompress. I get Resource interpreted as Stylesheet but transferred with MIME type application/x-gzip: Is this even possible?
Your Gzip file should have response header Content-Encoding: gzip while Content-Type should be text/javascript for JavaScript files or text/css for CSS files.
For me, following .htaccess rules does work:
AddEncoding x-gzip .gz
RewriteEngine On
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)$ $1.gz [QSA,L]
<FilesMatch \.js\.gz$>
ForceType "text/javascript; charset=utf-8"
Header set Cache-control: private
</FilesMatch>
Header set Vary: Accept-Encoding can be used instead of Header set Cache-control: private to prevent returning Gzipped version to user-agents that do not support Gzip compression.
.htaccess file should be placed in directory that contains js.
Gzipped and nongzipped versions should be placed side by side (filename for gzipped version contains .gz postfix). Gzip-encoded version is returned transparently (if .gz version exists and browser supports Gzip which Accept-encoding request header is responsible for) when requesting usual file without Gzip mentioned explicitly in its URL.
P.S. Ah, you are using ASP.net, and therefore it's apparently running under IIS. Well, recent versions of IIS have .htaccess-like functionality, AFAIK.