عربي
News
●E-invoicing: the last date to connect for wave 25 is February 1, 2027●WhatsApp Business: service messages are paid after 1,000 free per month●Salla acquires Paylink to strengthen payment solutions for merchants●Google launches a Gemini agent for businesses first, then consumers●Hostinger's White Friday deals continue until December 14

Set Cache-Control for HTML and versioned assets

Separate page and asset policies, then confirm a style change produces a different URL.

The problem

You change a booking button and some browsers still show the old style. A cache may hold the CSS under the same name for a long time. The HTML can also go stale when the same policy applies to every response. Match each resource's policy to how it is updated.

The tool

Cache-Control governs storage and revalidation. no-cache allows a stored response to be reused after validation. Public assets can use long lifetimes when a content change gives them a new URL.

The steps

  1. In staging, inspect the Cache-Control header for HTML, CSS and a sample image. Record their URLs for a comparison after deployment.
  2. Identify public content-addressed assets, public files with static names and responses that may contain account data. Review the groups independently.
  3. For a fingerprinted public file such as site.abc123.css, consider public, max-age=31536000, immutable when no different content will occupy that URL.
  4. For a public page that needs the newest version, try no-cache to require revalidation. Evaluate a policy such as no-store for sensitive account data when storage needs to be prevented.
  5. Change one CSS rule and publish to staging. Check that the new HTML links to a new asset and that a repeat visitor gets that version.
  6. Inspect headers from both the application and its CDN where applicable. A shared layer can override what you expected to send.

The real cost

Headers are part of HTTP. Budget time for deployment and checks against the real delivery path, including any CDN.

The free alternative

Without hashed filenames, start with revalidation for public assets that can change in place. Move to long lifetimes after URLs reliably change with content.

Notes

  • We have not tried these steps ourselves yet. They are based on the official docs. Button names may change. If your interface differs, follow the docs.
  • Keep a prior asset available while an earlier page can still reference it, especially during rolling deployments.
  • Evaluate private pages separately so a shared cache cannot store account content.

Sources

  1. developer.mozilla.org

Did you like this guide?

The weekly newsletter is being prepared. Leave your email and we'll send it when it launches.

We use your email only to send the newsletter. Privacy policy