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
- 1Cap Max-Age at 600 (10 minutes) for most APIs
- 2Use shorter windows (60s) during active CORS policy rollouts
- 3Most browsers cap Max-Age at 86400 (Chrome) or 600 (Firefox) regardless of what you set
Code examples
Express cors(): safe max age
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.
More api checks
- LowTRACE method referenced in API response body
- InfoREST endpoint allows DELETE
- LowGraphQL introspection field suggestions
- MediumGraphQL endpoint has no rate-limit headers
- LowOpenAPI server URL leaks internal host
- LowCORS preflight result not cached
- HighBearer token in URL query string
- MediumJSONP callback parameter accepted
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.