Skip to main content
LowAPI

How to fix: CORS preflight cache exceeds 24 hours

Access-Control-Max-Age above 86400 pins browsers to a stale allowlist. New disallowed headers or origins take up to Max-Age seconds to take effect.

Why it matters

An excessively long preflight cache means CORS policy changes, such as revoking an origin's access or removing a method, take days to propagate to browsers. Previously approved origins continue to receive cached preflight approval even after the server policy changes.

Access-Control-Max-Age above 86400 pins browsers to a stale allowlist. New disallowed headers or origins take up to Max-Age seconds to take effect.

How to fix it

  1. 1Cap Max-Age at 600 (10 minutes) for most APIs
  2. 2Use shorter windows (60s) during active CORS policy rollouts
  3. 3Most browsers cap Max-Age at 86400 (Chrome) or 600 (Firefox) regardless of what you set

Code examples

Express cors(): safe max age

JavaScript
import cors from 'cors';

app.use(cors({
  origin: ['https://app.example.com'],
  maxAge: 600,
}));

References

Detected automatically by VulnRadar. The check id is api-cors-preflight-cache-over-24h, stable across every scan so you can filter or diff on it.

See every api check

Questions

How severe is CORS preflight cache exceeds 24 hours?
VulnRadar rates this low severity in the api category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id api-cors-preflight-cache-over-24h, which stays the same between runs so you can filter, diff, or gate CI on it.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for cors preflight cache exceeds 24 hours

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

CORS preflight cache exceeds 24 hours fix | VulnRadar