Skip to main content
LowAPIOWASP A05:2021CWE-20

How to fix: Retry-After header is not a valid delay or date

The response carries a Retry-After header whose value is neither seconds nor an HTTP-date. Those are the only two forms RFC 9110 defines, and a client that cannot parse the header ignores it.

Why it matters

Clients that cannot parse the header fall back to their own retry policy, which is usually an immediate retry or a fixed short interval. Under the load that produced the 429 or 503 in the first place, that turns a throttled client into a retry storm, and it defeats the backoff the header exists to coordinate.

Common wrong values are "60s", an ISO-8601 timestamp, a float, or a bare word. The two legal forms are a decimal count of seconds ("120") and an IMF-fixdate ("Wed, 21 Oct 2026 07:28:00 GMT"). This check reads the header only; it does not judge whether the delay itself is reasonable.

How to fix it

  1. 1Emit either an integer number of seconds or an IMF-fixdate, with no unit suffix.
  2. 2Set it on every 429 and on 503 responses that come from a maintenance or overload path.
  3. 3Test the value with a client library rather than by eye: most will silently ignore what they cannot parse.

Code examples

Express: valid Retry-After forms

JavaScript
// Seconds
res.set('Retry-After', '120');

// Or an absolute time
res.set('Retry-After', new Date(Date.now() + 120_000).toUTCString());

res.status(429).json({ error: 'rate_limited' });

Nginx: fixed backoff on throttle

nginx
limit_req_status 429;

error_page 429 = @throttled;
location @throttled {
    add_header Retry-After 60 always;
    return 429;
}

References

Detected automatically by VulnRadar. The check id is api-retry-after-invalid-value, stable across every scan so you can filter or diff on it.

See every api check

Questions

How severe is Retry-After header is not a valid delay or date?
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-retry-after-invalid-value, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Retry-After header is not a valid delay or date map to?
It maps to CWE-20. In the OWASP Top 10 it falls under A05:2021.

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 retry-after header is not a valid delay or date

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

Retry-After header is not a valid delay or date | VulnRadar