Loading Gzipped version css/js in the document
sujitrulz opened this issue · comments
Hi @Stolz
As i can see, we have gzip version enabled and we are able to create .gz file on my local. I would like to know how does it actually load in the document. After checking the source code, i found it loads only the non gzipped file. Can you please help with this?
Since I requested this feature....
This is an NGINX feature. If it receives a request for file.css
, and it would send a compressed version of this file, then it looks in the filesystem for a pre-compressed version file.css.gz
.
If the file is found, it will send this, rather than compressing file.css
.
As Greg mentioned, this is a feature of the browser and the webserver, not the assets library itself.
In a nutshell: Some webservers, if properly configured, before serving a file some.file
to a client that has included the Accept-Encoding: gzip, deflate
in the request headers, will first look if the file some.file.gz
exists. If it does, then the file some.file.gz
is returned in the response along a Content-Encoding: gzip,deflate
response header. If the file does not exist, then some.file
will be returned instead.
The assets library just creates the file for your, but how it used depends on the browser and the webserver.