HTTP Cache
Hitting 304s
Across Servers

by Eric Fortis

Instead of re-downloading uncacheable documents, users can get a lightweight 304 Not Modified response regardless of which server they hit.

For that, the documents must respond with the same Last-Modified time header from all servers. The same applies when using the ETag header on Nginx as it generates them using that time.

For preserving modification times, deploy copying over with rsync --times.

By the way, send a Cache-Control: no-cache response header too. It prevents Chrome® from sometimes showing a 304 with a stale page. For example, when restoring a session, or when offline without a registered service worker.

Sponsored by: