Dev.to AI 🤖 Ai 👁 0 📖 2 min read

Your AI-built app may be caching private pages

You log out of your app on a shared laptop. The next person presses the back button and sees your account page. Or a CDN stores a page with your name on it and serves it to someone else. Both come from the same small th

You log out of your app on a shared laptop. The next person presses the back button and sees your account page. Or a CDN stores a page with your name on it and serves it to someone else.

Both come from the same small thing: missing Cache-Control headers on pages that hold private data. AI builders rarely add them, because the app works fine without.

Why it happens

Browsers, proxies and CDNs cache responses to save time. If your server does not say "do not store this", a cache may keep a copy of a page or an API response. That is fine for a logo. It is not fine for an account page, an invoice or an API call that returns a user's data.

How to check your own app

  1. Open your browser dev tools, Network tab, and load a page that shows private data.
  2. Click the main request and look at the response headers.
  3. Look for Cache-Control. For private pages you want no-store, or at least private, no-cache.
  4. Sign out, then press the back button. If the private page still shows, it was cached.
  5. Repeat for your API routes that return user data.

What to look for

  • No Cache-Control header on pages behind login.
  • public or a long max-age on any response that includes user data.
  • A CDN or hosting setting that caches everything by default, including paths with cookies or authorization headers.

How to fix it

  • Send Cache-Control: no-store on authenticated pages and on API responses with user data.
  • Keep long caching for static files such as images, fonts and hashed JS bundles.
  • If you use a CDN, set it to bypass the cache when a session cookie or Authorization header is present.

A prompt you can paste into your AI builder

"Review the response headers for every page and API route that needs a signed-in user. Add Cache-Control: no-store to them. Keep long cache times only for static assets with hashed filenames. Check that our CDN settings do not cache responses that carry a session cookie or an Authorization header."

What a scanner can and cannot tell you

An outside scan of your public pages can read the headers they return. It does not sign in, so it cannot see the headers on pages behind your login. Check those yourself, as above.

I work on ProofForge. The free scan covers what a visitor can see and says plainly what it could not check.

Check your own app from the outside, free. Run the free ProofForge scan on your live URL. No account needed for the first scan. It looks at your public site the way a stranger would and says pass, fail or inconclusive, so you know what is confirmed and what it could not see. One-time reports start at $9: see pricing. Building with an AI agent? There is an MCP server so it can check before it deploys.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.