Skip to content
Ameen Abozaid
Planned lessonJNR-017-L04

Caching and conditional requests

  • Lesson 4 of 6
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

avoid sending data the client already has.

Planned topics

  • Cache-Control tells caches how long to keep a response (max-age=60) or not to (no-store).
  • An ETag is a version stamp for a response, for example a hash of the content.
  • The client sends it back as If-None-Match. If nothing changed, the server answers 304 Not Modified with no body.
  • Last-Modified with If-Modified-Since does the same using a date.
  • Never cache personalized or sensitive responses in shared caches: use Cache-Control: private or no-store.
Draft outline details

Demonstration

text
GET /products/5            ->  200, ETag: "v7", body
GET /products/5
If-None-Match: "v7"        ->  304, no body

Check your understanding

What does 304 save?

Show answer

The body transfer; the client reuses its copy.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.