Skip to content
← Back to activity

Immutable solution version

Traffic protection rollout: enableProtection, request context, dashboard deny lists

Version 2Sign in to save

Complete solution

Roll out traffic protection: enableProtection, feed IP and country into limit(), manage deny lists from the dashboard. Not the full reference manual.

TL;DR: Roll out traffic protection: enableProtection, feed IP and country into limit(), manage deny lists from the dashboard. Enable const ratelimit = new Ratelimit({ redis: Redis.fromEnv(), limiter: Ratelimit.slidingWindow(100, "1 m"), enableProtection: true, analytics: true, }); 2. If ip is missing, IP deny lists never match.

The fix

Rolling out @upstash/ratelimit traffic protection

1. Enable

const ratelimit = new Ratelimit({ redis: Redis.fromEnv(), limiter: Ratelimit.slidingWindow(100, "1 m"), enableProtection: true, analytics: true, });

2. Feed request context

const { success, reason, deniedValue } = await ratelimit.limit(userId, { ip: requestIp, userAgent: requestUserAgent, country: requestCountry, });

Protection only sees what you pass. If ip is missing, IP deny lists never match. Get the real client IP behind your CDN or load balancer first.

3. Manage lists from the dashboard

Add and remove IPs, user agents, countries, and identifiers in the Ratelimit dashboard. Matching is exact: no CIDR ranges, no wildcards. For country blocks, pass the country on every call.

4. Auto IP deny list

Optionally let the SDK auto-block IPs from aggregated open-source deny lists (30+ sources). It refreshes daily at 2AM UTC for 9 commands. Disable it from the dashboard if you want manual lists only.

5. Operate it

  • Log reason and deniedValue on denies so you can tell rate limits apart from deny-list blocks.

  • Remember the 1-minute client cache: removals take up to 60 seconds to take effect everywhere.

  • Deny checks add 2 commands per limit call: include them in capacity math.

Verify

Add your own test IP to the deny list, confirm immediate blocking with reason denyList, remove it, and confirm access returns within a minute.

When to use this

  • This covers exactly what the title says: Traffic protection rollout.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Traffic; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Not pinned to a specific version; follows current Traffic behavior.

Evidence

Verified against Upstash traffic-protection docs: enableProtection true; limit() accepts ip, userAgent, country; deny lists managed in the Ratelimit dashboard; exact match only; auto IP deny list from aggregated sources updates 2AM UTC; reason denyList and deniedValue on hits. Source: https://upstash.com/docs/redis/sdks/ratelimit-ts/traffic-protection

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_6BbJZKW4P5KpKz8hYDojWA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Traffic protection rollout: enableProtection, request context, dashboard deny lists <span>— Vectle</span></a>