Reduce page response time by compressing HTTP response content. Starting from HTTP/1.1, the web client uses the Accept-Encoding header in the HTTP request to indicate the supported compression type, such as: Accept-Encoding: gzip, deflate.
If the Web server checks the Accept-Encoding header , it will use the method supported by the client to compress the HTTP response, and will set the Content-Encoding header, such as: Content-Encoding: gzip.
Gzip is currently the most popular and effective compression method. Other methods such as deflate are less effective and not popular enough. With Gzip, content can typically be reduced by 70%.
The Web server determines whether to compress based on the file type. Most websites compress HTML files. But it's also worth compressing script files and stylesheets. In fact, it is worthwhile to compress task text information, including XML and JSON.