Cache can be our best friend or our worst enemy, that is why understanding this issue is so important . Good cache configuration can easily improve user web experience.
11. Popular one’s
Code/Reason
•200/OK
•301/Moved Permanently
•302/Moved Temporaily
•304/Not Modifed
•400/Bad Request
•401/Unauthoized
•403/Forbidden
•404/Not found
•500/Internal Server Error
•503/Service Unavailable
Description
•Success!
•Resource moved,don’t check here again
•Resource moved, but check here again
•Resource hasn’t changed since last retrival
•Bad syntax?
•Client might need to authenticate
•Refused access
•Resource doesn’t exist
•Something went wrong during processing
•Server will not recive the request
15. Conditional request headers
•Expect
•If-Match
•If-Modified-Since
•If-None-Match
•If-Range
•If-Unmodified-Since
•Range
•Allows client to list server behaviors that it requires
for a request
•Gets the document if the entity tag matches the
current entity tag for the document
•Restricts the request unless the resources has been
modified since the specified date
•Gets the document if the entity tags supplied do not
match those of the current document
•Allows a conditional request for a range of a
document
•Restricts the request unless the resource has not
been modified since the specified date
•Request a specific range of a resource, if the server
support range request
16. Apache modules
mod_expires
•ExpiresActive On
•ExpiresByType image/jpg "access plus 1 year"
•ExpiresByType image/jpeg "access plus 1 year„
•ExpiresByType text/css "access plus 1 month„
•ExpiresByType application/pdf "access plus 1
month"
•ExpiresByType text/x-javascript "access plus 1
month"
•ExpiresByType application/x-shockwave-flash
"access plus 1 month"
•ExpiresByType image/x-icon "access plus 1 year„
•ExpiresDefault "access plus 2 days"
mod_headers
•<Files *.php>
•Header set Cache-Control
public,max-age=3600 </Files>
•<Files *.xml>
•Header set Cache-Control
"no-cache, no-store, must-
revalidate, max-age=0"
•</Files>