Apahce uses the mod_deflate compression module. Each time the client (such as a browser) retrieves data from the server (ps: Expires is not expired), the status code of the http request header is always 200, instead of 304 Not Modified.
304 Not Modified?
If the client sends a GET request with a condition and the request has been allowed, and the content of the document (since the last access or according to the condition of the request) has not changed, the server should return this status code. 304 the response is forbidden to contain the message body (which saves bandwidth and overhead). Therefore, it always ends with the first blank line after the message header.
Problem
F5 refresh. The status is always 200, as shown in the figure below:
This is a bug in Apahce itself. Apache uses gzip compression and cache at the same time, and the etag name is automatically changed to "******-gzip". Problems may occur when gzip exists.
Solution
If you use OneinStack and lnmp one-key installation package (ps: The latest download has solved this problem) and select lamp mode, the compression function is automatically enabled, you need to solve this problem as follows:
Put the last few lines of the file/usr/local/apache/conf/httpd. conf:
ServerTokens ProductOnly
ServerSignature Off
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript
DeflateCompressionLevel 6
SetOutputFilter DEFLATE
Include conf/vhost/*. conf
Replace:
<IfModule mod_headers.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript
<FilesMatch "\. (js | css | html | htm | png | jpg | swf | pdf | shtml | xml | flv | gif | ico | jpeg) $">
RequestHeader edit "If-None-Match" "^ (. *)-gzip (. *) $" "$1 $2"
Header edit "ETag" "^ (. *)-gzip (. *) $" "$1 $2"
</FilesMatch>
DeflateCompressionLevel 6
SetOutputFilter DEFLATE
</IfModule>
ServerTokens ProductOnly
ServerSignature Off
Include conf/vhost/*. conf
Restart apache:
Service httpd restart
Test