Vercel Firewall Vercel Managed edge platform (no version)

How to Set Up a WAF with Vercel Firewall

Complete guide to configuring the Vercel Web Application Firewall: custom rules, IP blocking, rate limiting, managed OWASP and bot rulesets, Attack Mode, and vercel.json config as code.

20-40 minutes beginner 10 steps
Last updated: Jul 18, 2026

Vercel is a hosting and edge platform, not a proxy you install software onto. Its firewall is a native product tier that already runs in front of every deployment, so there is nothing to compile, no agent to run, and no sidecar to keep alive. The Vercel Firewall is layered: a free, always-on platform-wide firewall provides automatic DDoS mitigation for every customer, and on top of it the configurable Vercel WAF lets you write your own logic.

This guide covers the WAF layer you actually configure: IP blocking, custom rules that log, deny, challenge, bypass, redirect, or rate limit traffic, the plan-gated managed rulesets (OWASP Core Ruleset, Bot Protection, AI Bots), and Attack Mode for active DDoS events. Unlike a rule-language WAF such as ModSecurity, Vercel does not run the OWASP Core Rule Set as SecLang; it exposes a condition and action model in the dashboard, in vercel.json, and through the Firewall REST API.

One property makes Vercel pleasant to operate: dashboard firewall changes take effect globally within 300ms and do not require a re-deployment, and you can instantly roll back to any prior configuration from the audit log. That means you can tune rules in log mode against live traffic and promote them to blocking with near-zero risk.

Prerequisites

  • A project already deployed on Vercel (Hobby, Pro, or Enterprise plan)
  • A team role that can apply rules (Project administrator, Team member, or Security)
  • Pro plan or higher to go beyond 3 custom rules and a single rate limit rule
  • Enterprise plan for the OWASP Core Ruleset managed ruleset and account-level IP blocking; the Bot Protection managed ruleset is generally available on all plans at no additional cost, while the AI Bots ruleset tier is less clearly documented, so confirm what your plan includes
  • Familiarity with your application's routes, hostnames, and expected traffic patterns
  • Optional, the Vercel CLI if you plan to manage rules as code in vercel.json

Step-by-Step Guide

1

Understand the Two Firewall Layers

There is nothing to install. Vercel's firewall is already in front of your deployment, and it runs in two layers that you should understand before touching any settings:

  • Platform-wide firewall (automatic, free, all plans): Provides DDoS mitigation at layers 3, 4, and 7. It blocks abnormal or suspicious request volumes with no configuration required and cannot be disabled.
  • Vercel WAF (configurable): The layer you own. Here you define IP blocks, custom rules, and, depending on your plan, managed rulesets.

The firewall evaluates rules in a fixed execution order: DDoS mitigation first, then WAF IP blocking, then WAF custom rules, then WAF Managed Rulesets. Custom rules run in the order you arrange them, so precedence matters and you can reorder them.

Tip: Because the platform-wide firewall already handles DDoS for free on every plan, most teams only need to configure the WAF layer for application-specific threats, abusive clients, and API abuse.
2

Open the Firewall Dashboard and Watch Traffic First

Do not write blocking rules blind. Start by looking at real traffic so your conditions match what is actually hitting your site.

  1. From your dashboard, select the project you want to protect.
  2. Open Firewall in the project sidebar.
  3. Use the traffic monitoring view and its live traffic window to group requests by parameter, for example by path, IP address, user agent, JA4 Digest, or country. This is the same observability surface you will use to validate every rule you write.

Identify the patterns you want to act on: a scraper's IP or ASN, a flood of requests to one API path, requests for files that should never exist such as .env or .git, or traffic from regions you do not serve.

Tip: For deeper analysis or long-term retention, wire up <a href="https://vercel.com/docs/drains/using-drains">Log Drains</a> to ship firewall events to your SIEM. Firewall alerts can notify you the moment a spike or attack begins.
3

Block Known-Bad IP Addresses

IP blocking is the simplest and highest-precedence WAF control; it runs before your custom rules. Use it for known malicious addresses, scrapers, or competitors, not for geo restrictions (use a custom rule for geography instead).

  1. In Firewall, select Configure at the top right.
  2. Scroll to the IP Blocking section and select + Add IP.
  3. Fill in the IP Address Or CIDR field and the Host field. The host is the exact domain the block applies to, entered without the https prefix, for example www.my-site.com. Add a separate entry for each subdomain you want to cover.
  4. Select Create IP Block Rule, then Review Changes and Publish.

Project-level IP blocking is capped by plan: up to 3 on Hobby, up to 100 on Pro, and up to 1000 on Enterprise. Enterprise also offers account-level IP blocking from Team Settings, where CIDR rules are limited to /16 for IPv4 and /48 for IPv6.

Warning: IP blocks are per host. If you serve the same project on an apex domain, a www subdomain, and other subdomains, add an entry for each; a block on my-site.com does not cover www.my-site.com.
4

Create Your First Custom Rule in Log Mode

Custom rules are the core of the Vercel WAF. Each rule is one or more If conditions combined with AND or OR, plus a Then action. Always build a new rule in log mode first so it records without blocking.

  1. In Firewall, select Configure, then Add New... > Rule.
  2. Name the rule so its purpose is clear later.
  3. Add If conditions. Available parameters include Request Path and Target Path, Request Method, Hostname, IP Address, User Agent, Request Header, Cookie, Query, Geolocation (continent, country, region, city), AS Number, and the JA4 Digest TLS fingerprint (JA3 is Enterprise only). Operators include equals, not equals, contains, starts with, ends with, matches regex, exists, and is in set, and any operator can be negated.
  4. Set the Then action to Log.
  5. Select Save Rule, then Review Changes and Publish.

Example goals you can express directly: deny requests whose path ends in .php, .env, or .git; challenge requests whose user agent contains curl or wget; or deny traffic from countries you do not serve.

Tip: If you prefer, describe the rule in natural language in the text box at the top of the form and select <strong>Generate Rule</strong>. Vercel builds the conditions and action for you, and you can still edit the result before saving.
5

Verify the Rule, Then Promote It to Blocking

This is the step most people skip and regret. With the rule live in log mode, watch how it behaves against real traffic before you let it block anything.

  1. On the Firewall overview page, select your rule from the traffic grouping dropdown and pick the parameters tied to your conditions.
  2. Observe roughly 10 minutes of live traffic. Confirm the rule matches the abusive requests you intended and does not catch legitimate users.
  3. If the match set is wrong, edit the conditions and observe again.
  4. Once you are satisfied, select Configure, open the rule, and change the Then action to Challenge, Deny, or Bypass as appropriate. Save, review, and publish.

Know what each action does: Deny returns 403 Forbidden and the request never reaches your app (and is not billed as an Edge Request or Fast Data Transfer). Challenge serves a Vercel Security Checkpoint that only a real JavaScript-capable browser can pass, creating a 1-hour session. Bypass lets trusted traffic skip the remaining rules.

Warning: The challenge action blocks non-browser clients by design. If you protect an API path with challenge, direct calls from cURL, Postman, or server-to-server scripts will fail because they cannot solve the JavaScript challenge or hold a challenge session. For trusted automation, add a higher-precedence bypass rule instead.
6

Add a Rate Limit Rule for API and Login Abuse

Rate limiting is a custom rule whose action is Rate Limit. Use it to cap requests from a single source to an endpoint, which protects APIs and login forms and helps control usage costs.

  1. Create a new rule and add If conditions that scope it, for example Request Path starts with /api or equals /auth/login.
  2. Set the Then action to Rate Limit.
  3. Choose the limiting strategy: Fixed Window (all plans) or Token Bucket (Enterprise).
  4. Set the Time Window (defaults to 60s) and the Request Limit (defaults to 100 requests per window).
  5. Choose the counting key(s): IP and JA4 Digest are available on all plans; User Agent and arbitrary Header keys are Enterprise only.
  6. Choose the action when the limit is exceeded: leave the Default (429) response, or select Log, Deny, or Challenge. Save, review, and publish.

Windows range from a 10s minimum to a 10 minute maximum on Hobby and Pro, and up to 1 hour on Enterprise. Rate limit rule counts are capped per plan: 1 rule on Hobby, 40 on Pro, and 1000 on Enterprise.

Warning: Rate limit counters are tracked per region. Traffic that matches the same key across multiple Vercel regions can exceed your configured limit in aggregate, so set thresholds with per-region counting in mind.
7

Auto-Block Repeat Offenders with Persistent Actions

A normal deny or challenge rule only acts on requests that match its condition. A client that trips the rule once can still send other requests that do not match. Persistent actions close that gap by adding a time-based IP block.

  1. Edit (or create) a custom rule whose action is Challenge, Deny, or Rate Limit.
  2. In the action row, use the for timeframe dropdown (it defaults to 1 minute) to select how long to block the offending client.
  3. Save, review, and publish.

When the rule matches, the client's IP is stored in the platform-wide firewall and blocked for the timeframe you chose. Because that block happens before the firewall processes further requests, the blocked traffic does not count toward your CDN and traffic usage. This is ideal for brute-force protection, for example rate limiting POST /auth/login to 10 requests per minute per IP and denying for 15 minutes.

Tip: Leave the timeframe empty if you do not want a persistent block; the rule then acts only on matching requests, request by request.
8

Enable Managed Rulesets

Managed Rulesets are predefined collections you enable rather than author, and they run after your custom rules in the execution order. The OWASP Core Ruleset requires Enterprise, while the Bot Protection managed ruleset is generally available on all plans at no additional cost. Vercel's docs are not fully consistent here (the WAF limits table still marks managed rulesets as unavailable on Hobby and Pro, whereas the Bot Protection GA announcement says all plans), and the AI Bots ruleset tier is less clearly documented, so confirm what your plan includes before relying on it.

  • OWASP Core Ruleset: Rules based on the OWASP Top Ten. Enable the whole set, or open Configure to toggle individual rules and set each one to Log or Deny.
  • Bot Protection Managed Ruleset: Inactive by default (shown as Off). Set it to Log or Challenge; in challenge mode the WAF serves a JavaScript challenge to traffic unlikely to be a browser.
  • AI Bots Managed Ruleset: Inactive by default (shown as Allow). Set it to Log or Deny to monitor or block traffic identified as AI crawlers.

Enable and configure these from Firewall > Rules in the project sidebar, then review and publish. As with custom rules, start each in Log and watch live traffic before switching to Challenge or Deny.

Warning: If a managed ruleset blocks legitimate traffic, for example Bot Protection challenging a trusted custom user agent, do not disable the whole ruleset. Add a higher-precedence custom rule with the Bypass action that targets the specific traffic, since custom rules execute before managed rulesets.
9

Use Attack Mode During an Active DDoS

Attack Mode is an emergency toggle for highly targeted attacks. When enabled, every browser visitor must pass a security challenge before reaching your site, while known legitimate bots (search engines, webhook providers) and your own internal Function and Cron traffic are allowed through automatically.

  1. Open Firewall in the project sidebar.
  2. Click Bot Management.
  3. Under Attack Mode, select Enable.
  4. When the attack subsides, return here and select Disable.

Attack Mode is free on all plans, and requests it blocks do not count toward your usage. It will not hurt SEO, since crawlers like Googlebot are allowed through. Because the platform already mitigates DDoS automatically, reserve Attack Mode for active, targeted incidents rather than leaving it on permanently.

Warning: Standalone APIs, non-browser backend frameworks, and unrecognized automated services may be unable to solve the challenge and can be blocked while Attack Mode is on. If you need finer control, use a targeted custom rule with a challenge action instead of a site-wide Attack Mode toggle.
10

Manage Rules as Code and Roll Back Safely

Dashboard changes are instant and need no deploy, but you can also version firewall rules with your codebase. In vercel.json, use the routes property with has or missing conditions and a mitigate action:

{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "routes": [
    {
      "src": "/(.*)",
      "has": [
        { "type": "header", "key": "x-react-router-prerender-data" }
      ],
      "mitigate": { "action": "deny" }
    }
  ]
}

Only challenge and deny are supported in vercel.json; the log, bypass, and redirect actions are dashboard-only. Note the tradeoff: vercel.json rules ship with a deployment, whereas dashboard rules apply globally within 300ms with no re-deployment. For scripted or CI-driven management, the Firewall API (via the @vercel/sdk examples, using vercel.security.updateFirewallConfig) can create and update rules programmatically.

Whichever path you use, you can recover fast: open the ellipsis menu on the Firewall overview, choose View Audit Log, pick a prior version by date and time, and select Restore to instantly roll back the configuration.

Tip: Keep emergency, fast-iteration rules in the dashboard where they apply in 300ms and roll back instantly; keep stable, reviewed rules in vercel.json so they are code-reviewed and travel with your deployment.

Conclusion & Next Steps

Your Vercel project now has layered protection you control: automatic platform DDoS mitigation underneath, plus a WAF configured with IP blocks, custom rules for deny, challenge, bypass, redirect, and rate limiting, persistent actions for repeat offenders, and the managed rulesets (the Enterprise-only OWASP Core Ruleset plus the Bot Protection and AI Bots rulesets), with Attack Mode ready for active incidents.

Next steps:

  • Keep every new rule in Log mode and watch ~10 minutes of live traffic before promoting it to Deny or Challenge
  • Wire Log Drains to your SIEM and enable Firewall alerts
  • Add persistent actions to your brute-force and abuse rules so repeat offenders are blocked at the platform edge
  • Enable the managed rulesets your plan includes in Log first, then move individual rules to Deny or Challenge as you confirm they are clean
  • Version stable rules in vercel.json and rely on the audit log for instant rollback of dashboard changes

Troubleshooting

I created a rule but nothing is being blocked

Check the action. A rule set to Log records matches without blocking; that is the intended first state. Open Configure, edit the rule, and switch the Then action to Deny or Challenge, then Review Changes and Publish. Also confirm you actually published; unsaved or unpublished edits do not take effect.

My change is not live yet

Dashboard firewall changes apply globally within 300ms and need no re-deployment, so if a change is not visible you almost certainly did not Publish it. Rules defined in vercel.json are different: they are part of the deployment and only take effect after that deployment goes live.

My API calls from cURL or Postman started returning blocks

A challenge rule (or Attack Mode) is protecting that path. Challenges can only be solved by a real JavaScript browser holding a valid 1-hour session, so direct script, cURL, and server-to-server calls fail. Add a higher-precedence bypass rule targeting your trusted automation, or use deny/rate-limit instead of challenge on machine-facing endpoints.

An IP block is not working on my www or subdomain

IP blocks are scoped to a Host. A block on my-site.com does not cover www.my-site.com or docs.my-site.com. Add a separate IP block entry, with the host value entered without the https prefix, for every domain and subdomain you serve.

My rate limit lets more traffic through than I set

Rate limit counters are tracked per region. A client hitting multiple Vercel regions can exceed your per-region limit in aggregate. Lower the threshold, or account for regional counting when sizing it. Also confirm the follow-up action is Deny or the Default 429 rather than Log, since Log alone does not throttle.

A legitimate client is blocked by a managed ruleset

Do not turn off the whole ruleset. Because custom rules execute before managed rulesets, add a custom rule with the Bypass action that matches the specific trusted traffic (for example a known User Agent) and place it above the blocking rules.

I hit the rule limit for my plan

Custom rules are capped per plan: up to 3 on Hobby, 40 on Pro, and 1000 on Enterprise, and IP blocks and rate limit rules have their own caps. Consolidate conditions into fewer rules using AND/OR and the "is in set" operator, or upgrade the plan. The OWASP Core Ruleset managed ruleset and account-level IP blocking require Enterprise; the Bot Protection managed ruleset is generally available on all plans, while the AI Bots ruleset tier is less clearly documented, so check what your plan includes.

A rule change caused an outage or false-positive storm

Use instant rollback. Open the ellipsis menu on the Firewall overview, choose View Audit Log, select the last known-good version by date and time, and Restore it. Then reintroduce the rule in Log mode and validate against live traffic before switching it back to blocking.

Frequently Asked Questions

Do I need to install anything to use the Vercel WAF?

No. Vercel is a hosting and edge platform, and its firewall is a native product tier that already runs in front of every deployment. There is no agent, module, or proxy to install. You configure the WAF from the project's Firewall dashboard, in vercel.json, or through the Firewall REST API, and dashboard changes take effect globally within 300ms without a re-deployment.

Does Vercel run the OWASP Core Rule Set like ModSecurity?

Not as SecLang. Vercel exposes a condition-and-action model rather than a rule language. On Enterprise, it offers an OWASP Core Ruleset managed ruleset based on the OWASP Top Ten that you enable and set per rule to Log or Deny. It is not the same as running the full OWASP CRS in a self-managed WAF, and it is Enterprise-only.

What actions can a Vercel WAF custom rule take?

A custom rule can log, deny (403), challenge (a JavaScript browser check), bypass (skip remaining rules), redirect, or rate limit matching traffic. In vercel.json only challenge and deny are supported; log, bypass, and redirect are dashboard-only. Best practice is to build every rule in log mode, watch about 10 minutes of live traffic, then promote it to a blocking action.

What is the difference between Attack Mode and a challenge rule?

Attack Mode is a site-wide emergency toggle: it challenges every browser visitor during a targeted DDoS while automatically allowing known bots and your own internal Function and Cron traffic. A challenge custom rule is scoped: it only challenges traffic that matches your conditions. Use Attack Mode for active incidents and custom rules for targeted, ongoing control. Both are built on the same Vercel Security Checkpoint challenge.

Do WAF rules add latency or extra cost?

WAF evaluation happens at Vercel's edge in front of your deployment, so there is no round trip to a separate agent as with a self-hosted WAF. Denied requests never reach your app and are not billed as Edge Requests or Fast Data Transfer, and traffic blocked by persistent actions or Attack Mode does not count toward usage. Rate limiting and some parameters have plan-based limits; review Usage and Pricing for details.

Can I manage Vercel firewall rules as code?

Yes. You can define rules in vercel.json using the routes property with has or missing conditions and a mitigate action (challenge or deny only), or manage rules programmatically with the Firewall API (using the @vercel/sdk vercel.security.updateFirewallConfig method). Note that vercel.json rules ship with a deployment, whereas dashboard changes apply within 300ms and can be rolled back instantly from the audit log.

What happens to my rules if I make a mistake?

Every firewall configuration change is versioned. From the Firewall overview, open the ellipsis menu, choose View Audit Log, pick a prior version by date and time, and select Restore to instantly roll back. Combined with log mode for testing, this makes it safe to iterate on rules against production traffic.

Related Guides