One: HTTP content compression
Thinking: Content-length In previous studies, we know that the length of the body that represents the return
But here, why is the returned body length inconsistent with content-length?
The reason: Content-encoding:gzip this response header information in action.
Principle: In order to improve the transmission speed of web pages on the network, the server compresses the main information.
such as common gzip compression, deflate compression, compress compression, and Google Chrome are pushing SDCH compression.
The process of compression is like this
How do I enable the compression feature in Apache?
1: Turn on the deflate module, or the GZIP module
2: In the Conf file, write the following code
<ifmodule mod_deflate.c>
Deflatecompressionlevel 6 # Compression level 6, optional 1-9, 6 recommended
Addoutputfilterbytype DEFLATE Text/plain # Compressed text file
Addoutputfilterbytype DEFLATE text/html # compressing HTML files
Addoutputfilterbytype DEFLATE text/xml # Compressed XML
</ifmodule>
Why do you want to specify a file type to compress?
A: Compression is also to consume CPU resources, Pictures/videos and other files, compression effect is not good.
Generally compressed text format.
Before compression:
HTTP Content Compression