Cache-Control
Cache-Control
general-header field is used to specify deirectives that MUST be obeyed by all caching mechanisms along the request/response chain.
When the Cache-Control
allow to cache, like Cache-Control: public, max-age: 86400
, it means that in this day the browser can use the cahce directly without any request to server.a
1 | import http: 'http' |
Etag
Used for conditional HTTP request.
Etag
represents Version of Resource, browser will add If-None-Match
in headers with request. If the resource on server has not been modified, code 304 will be returned.
1 | import http from 'http' |
Last-Modified
Similar to Etag
, Last-Modified
represents if the resource modified. It uses time when modified
instead of version tag
.
The key in header is If-Modified-Since
1 | import http from 'http' |