Skip to main content
MediumAPI

How to fix: Rate-limit headers present but only enforced on some paths

Returning X-RateLimit-* headers without enforcing the cap is theatre. Callers see budgets they cannot exceed in the response but can hammer the server anyway.

Why it matters

Advertising rate limits that are not enforced creates a false sense of security. Automated scanners and attackers will ignore the headers and keep sending requests, while the server has no actual protection against abuse or DoS.

Returning X-RateLimit-* headers without enforcing the cap is theatre. Callers see budgets they cannot exceed in the response but can hammer the server anyway.

How to fix it

  1. 1Ensure every endpoint that emits X-RateLimit-* headers actually enforces the limit
  2. 2Test rate limiting in CI by sending requests above the stated limit and verifying 429 responses
  3. 3Apply rate limit middleware globally before route handlers rather than per-route to avoid gaps

Code examples

Express: global rate limit applied before all routes

JavaScript
import rateLimit from 'express-rate-limit';

// Apply globally so no route can slip through
app.use(rateLimit({
  windowMs: 60 * 1000,
  max: 100,
  standardHeaders: true,
  legacyHeaders: false,
}));

// Routes come after: rate limit is always applied
app.use('/api', apiRouter);

References

Detected automatically by VulnRadar. The check id is api-rate-limit-headers-not-enforced-on-paths, stable across every scan so you can filter or diff on it.

See every api check

Questions

How severe is Rate-limit headers present but only enforced on some paths?
VulnRadar rates this medium 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-rate-limit-headers-not-enforced-on-paths, 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 rate-limit headers present but only enforced on some paths

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

Rate-limit headers present but only enforced on some paths | VulnRadar