Prompt

How do I set up cache rules without breaking deployments?

Technology / CDN & Edge Infrastructure1 observationLast seen Oct 12, 2026

Latest observation

Oct 12, 2026OpenAI APIWeb search: off

To set up cache rules safely, the key is to avoid caching anything that changes during deployments unless you also version it.

Safe approach

1) Cache only immutable assets

Cache files that get unique names when they change, like:

  • app.4f3c2.js
  • styles.a91b7.css
  • logo.9d1e.png

If a file’s content changes, its filename should change too. Then you can cache it aggressively.

2) Do not long-cache HTML

Your HTML page shell should usually be:

  • Cache-Control: no-cache or
  • Cache-Control: max-age=0, must-revalidate

Why: HTML references your assets. If HTML is cached too long, users may keep seeing old asset links after a deploy.

3) Use different cache rules by file type

A common setup:

  • HTML: short-lived or revalidated every time
  • JS/CSS/images/fonts with hashed names: long cache, e.g. 1 year
  • API responses: cache carefully, usually short or conditional
  • Admin/auth pages: no cache

Example:

HTML:
Cache-Control: no-cache

Hashed static assets:
Cache-Control: public, max-age=31536000, immutable

4) Version your assets

If you can’t hash filenames, use versioned paths:

  • /v123/app.js
  • /release-2026-10-12/app.js

Then each deployment points to a new versioned path, preventing stale assets.

5) Purge or invalidate on deploy if needed

If you use a CDN or reverse proxy cache:

  • purge changed HTML and non-versioned assets on deploy
  • avoid purging hashed assets; they can just expire naturally

6) Test the deployment flow

Before rolling out:

  • deploy to staging
  • hard refresh and normal refresh
  • test from a browser with old cached assets
  • verify old HTML doesn’t reference missing files
  • verify new HTML references new hashed assets

Common failure mode

A deployment breaks when:

  • HTML is cached
  • JS/CSS filenames are not versioned
  • a new deploy deletes old assets before all cached HTML has expired

To prevent that, either:

  • keep old assets around for a while, or
  • make filenames immutable and versioned

Recommended rule of thumb

If users may request the same URL before and after a deploy:

  • cache it only if its content never changes
  • otherwise revalidate or version it

If you want, I can give you a cache policy specifically for:

  • Nginx
  • Cloudflare
  • AWS CloudFront
  • a React/Vite/Webpack app
  • an API + static site setup

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.