http support for caching & replication. conditional requests server executes conditional...
TRANSCRIPT
![Page 1: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f275503460f94c3f668/html5/thumbnails/1.jpg)
HTTP support for caching & replication
![Page 2: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f275503460f94c3f668/html5/thumbnails/2.jpg)
Conditional requests
• Server executes conditional request.
• Responds with a message body only if the condition is true.
• Condition false: 304 Not Modified
• Servers provide meta-information through last-modified and ETag.
• Example ETag: MD5
![Page 3: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f275503460f94c3f668/html5/thumbnails/3.jpg)
Conditional Headers (caching)
• If-modified since (execute request if requested object updated since last-modified date).
• IMS requests.
• If-none-match (execute request if ETag of requested object is different).
![Page 4: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f275503460f94c3f668/html5/thumbnails/4.jpg)
Conditional Headers (replication)
• Conditional headers to be used with update requests.
• If-unmodified-since (execute request if the object’s last-modified date matches the supplied date).
• If-match (execute request if the object’s ETag matches the supplied ETag).
• If-match ≠ if-not-match, if-modified-since ≠ if-unmodified-since.
![Page 5: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f275503460f94c3f668/html5/thumbnails/5.jpg)
Age and Expiration of cached objects
• HTTP server: explicit time to live with expires and max-age headers.
• Expires: data up to which the cached object may be considered valid.
• Max-age: max age the object may reach before validation.
• Expires: absolute value of TTL. Max-age: specifies the TTL relative to the time the object left.
![Page 6: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f275503460f94c3f668/html5/thumbnails/6.jpg)
Request redirection
• 300 Multiple Choices (choices are provided in entity body).
• 301 Moved permanently (location header)
• 302 Found (location header)
• 303 See other (location header)
• 305 use proxy (location header)
• 307 Temporary redirect (location header)
![Page 7: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f275503460f94c3f668/html5/thumbnails/7.jpg)
Range Requests
• Range header: byte range of the entity being retrieved.
• Status line: 206 Partial content
![Page 8: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f275503460f94c3f668/html5/thumbnails/8.jpg)
Cache-control header
• The cache-control header contains multiple directives that control the use of all the caches between the client and the origin server.
• Cache-control: present in requests and responses (general header).
![Page 9: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f275503460f94c3f668/html5/thumbnails/9.jpg)
Cache-control in requests
• No-cache: cached objects cannot be used to satisfy the request.
• No-store: the response cannot be stored in a cache.• Max-age: only younger cached objects can be used to
satisfy the request.• Min-fresh: only cached objects that will not expire for a
specified time can be used.• Max-stale: cached objects that expired up to the
specified time ago can be used.• No-transform: only the precise response as provided by
the origin server can be user.• Only-if-cached: a proxy should not forward the request
on a cache miss.
![Page 10: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is](https://reader036.vdocuments.us/reader036/viewer/2022082819/56649f275503460f94c3f668/html5/thumbnails/10.jpg)
Cache-control in responses
• No-cache: response cannot be cached.• No-store: response cannot be stored in any client.• Private: the response can be reused only for the client
that originally requested it.• Public: the response can be cached and shared among
different clients.• Must-revalidate: a cache must always validate the
cached object.• Proxy-revalidation: same as must-revalidate but applies
to proxy caches only.• Max-age: a cache must validate this object before
serving it once the object age reaches specified value.