A product photograph can travel from the store to an edge server once and reach many shoppers from there. A shopping cart belongs to one customer. A content delivery network sits in front of both, but those two requests need very different treatment.

A copy close to the reader

Imagine a London publisher with readers in Sydney. When the Sydney edge has a fresh copy of the publication’s cover, it can send the image without contacting London. The publisher still controls the original file. When the edge has no usable copy, it must fetch or validate one against an upstream server.

What stays with the application

Two people can ask for the same cart URL and receive different items and prices. Sharing one response would disclose a customer’s purchase. Keep carts, account pages and other personalized responses outside shared caching. The CDN can still terminate a visitor’s HTTPS connection and forward an eligible request to the application.

Start with one public file

Pick an image with a version in its filename. Publish a new version under a new name and change the page reference. Readers with the old page can still fetch its old image, and readers with the new page get the corresponding release. Inspect delivery logs to see whether requests for each file reached the origin.

Sources & further reading

Reader questions

Does a CDN replace my web host?

Your web host still publishes the original application and assets. Plan for the origin to serve cache misses and every request that requires application state.