Text compression

What is text compression ?

Text compression allows you to compress all the resources of your website that use text (html, JavaScript, CSS style, AJAX calls). 

Why is it important ?

This operation reduces the weight of the data sent to the client : the server will compress the targeted data, then send it to the browser, which will decompress it and use it to display the text content of your page. Thanks to this process, the user experience will be improved because the loading time of your web page that will be reduced.

How to implement text compression ?

There are several compression formats and methods: Gzip, Deflate and Brotli.

When a request is made from a browser to a server, the server specifies in an HTTP header "Accept-Encoding" the algorithms it supports.

Accept-Encoding: gzip, compress, br

In return, the server will then reply with the indication "Content-Encoding" in the HTTP header to specify which compression algorithm was used.

Content-Encoding: gzip

It is important not to activate the text compression on other types of resources such as images, videos, etc, and to set it up on the WEB server of your site.