Far-future Expires headers and file versioning
Most of the time taken to display a page is spent fetching images, stylesheets and scripts. A far-future Expires header removes those requests for returning visitors, provided each file’s address changes whenever its content does.
Set the headers by type
Configure mod_expires, or the equivalent on other servers, to send an expiry a year ahead for images, CSS and JavaScript, and leave HTML documents on a short or zero lifetime. Confirm the result with a header inspection tool rather than from the configuration file.
Version the filename
Include a version or build number in the file name or path and update references at release. A query-string version is simpler to implement, but some proxy caches will not store addresses containing a query string, which removes part of the benefit.
Review entity tags on clusters
Apache’s default ETag includes the file inode, so the same file on two load-balanced servers produces different validators and avoidable downloads. Configure ETags from size and modification time only, or remove them where Last-Modified is sufficient.
After enabling long expiry, every unversioned asset change becomes a support call asking the user to refresh. Do not enable the header until the versioning step is part of the release procedure.