Skip to content

Load test an app on Vercel

A load test against a Vercel deployment goes wrong in three ways. Vercel’s protections answer instead of your app, the CDN answers instead of your code, or the usage bill grows during the test. This page sets up a MaxoPerf test that avoids all three: you pass Vercel’s bypass header from a workspace secret, aim at routes that run your code, and read the results per route type.

For the reasoning behind each step, read Load testing Vercel without getting blocked and What a Vercel load test measures.

You need a Vercel project with a Staging or dedicated Preview deployment, a MaxoPerf workspace, and a test that already runs. If you have no test yet, follow Run your first test first.

Vercel’s load-testing guide sets the ground rules:

  • Coordinate with Vercel before significant load, especially volumetric tests. A test that needs 50k or more requests per second needs a ticket with Vercel’s engineering team.
  • Run against a Staging or dedicated Preview deployment with production-like configuration and data, not production.
  • Ramp gradually. Vercel warns against an instant jump to a very high rate that production never sees.
  • You are responsible for any cost the test accrues.

Vercel’s guide says that when you benchmark cached static assets, you mostly measure the CDN, not your code paths. Pick dynamic routes and API routes instead.

Check each candidate route with one request:

Terminal window
curl -sI https://your-preview-url.vercel.app/api/products | grep -i x-vercel

Read x-vercel-cache in the output. HIT, PRERENDER and STALE mean the response came from cache or static storage. MISS and BYPASS mean the request reached your function or origin. Vercel notes that for dynamic routes the header often shows MISS even when the data came from its runtime cache, so MISS tells you the CDN did not answer, not that every layer behind it was cold. The x-vercel-id header lists the regions the request hit and the region the function ran in.

Keep the routes that return MISS or BYPASS and drop the ones that return HIT or PRERENDER.

Deployment Protection (Vercel Authentication, Password Protection, Trusted IPs) and Vercel’s Firewall system mitigations answer a load generator with a challenge or a block. Vercel’s Protection Bypass for Automation, available on all plans, lets requests that carry a secret skip those checks.

  1. In your Vercel project settings, open the Protection Bypass for Automation section and add a secret. Vercel’s documentation lists the permissions you need and the click path.
  2. Copy the secret. Vercel sets one secret as the VERCEL_AUTOMATION_BYPASS_SECRET system environment variable in your deployments.
  3. If you regenerate or delete the secret later, redeploy. Vercel sets the variable at build time, so earlier deployments keep the old value.

The secret is sent as an HTTP header named x-vercel-protection-bypass. Vercel also accepts a query parameter with the same name, but URLs get logged, so use the header.

  1. Open the workspace’s Secrets page and click Create secret. Name it VERCEL_BYPASS. Secret names allow letters, digits and underscores, so a hyphenated name is rejected.
  2. Paste the value from Vercel and save. MaxoPerf encrypts it and never shows it again.
Workspace secrets. The list shows names and versions, never values. Add the Vercel bypass secret here.
  1. Open the test and switch to the Dependencies tab.
  2. Add a Secret dependency and pick VERCEL_BYPASS.
  3. In Env name, type VERCEL_BYPASS, or leave it empty to use the secret’s name. The console adds the SECRET_ prefix, so the runner receives SECRET_VERCEL_BYPASS.
The Dependencies tab of a test. A secret row lists the SECRET_ variable it injects. This example binds a different secret; yours shows SECRET_VERCEL_BYPASS.

Read the variable in your test the same way as any other secret. The header name is the only part that is specific to Vercel.

Taurus:

headers:
x-vercel-protection-bypass: ${__env(SECRET_VERCEL_BYPASS)}

k6:

const params = { headers: { 'x-vercel-protection-bypass': __ENV.SECRET_VERCEL_BYPASS } };

JMeter, in an HTTP Header Manager:

x-vercel-protection-bypass = ${__BeanShell(System.getenv("SECRET_VERCEL_BYPASS"))}

The bypass skips Password Protection, Vercel Authentication, Trusted IPs checks, Firewall system mitigations and Bot protection challenges. It does not override active DDoS mitigations, rate limits applied during a detected attack, or challenges triggered by attack patterns. A large, sudden test can look like an attack, so ramp up.

Vercel’s guide lists two Firewall points that the header does not solve:

  • System Bypass rules do not bypass Attack Mode. Turn Attack Mode off for the duration of the test.
  • System Bypass rules match on a source IP or range, and Vercel limits them to 10 rules per project on Pro and 75 on Enterprise. MaxoPerf publishes no runner IP list for managed locations, so use the header there. A private location generates load from your own network, so you know the egress IP and can put it in a rule.

Vercel advises preferring bypass rules over Pause System Mitigations, because pausing removes system mitigations for the entire project for 24 hours and you are responsible for the usage from all traffic in that window.

A single average over every request hides the difference between a cached page and a function call. Give each request a label that names its route, so the results have one row per label.

  • Taurus: set label: on each request.
  • k6: pass a name tag in the request params, for example { tags: { name: 'GET products' } }.
  • JMeter: the sampler name is the label.

After the run, open the run’s Request stats tab. It lists each label with its sample count, and a COMBINED row for all labels together. Compare the labels that return MISS with any cached routes you kept, and judge latency per label, not from the COMBINED row.

The Request stats tab of a finished run. One row per label, plus a COMBINED row. A seeded demo run against a demo shop, not a Vercel deployment.

When a finished run has at least 100 samples and at least 30 percent of them were answered 403 or 429, or the target’s WAF identified itself and some requests were blocked, the run’s Overview shows a Blocked traffic notice. It gives the blocked share and the response codes, then lists fixes: allowlist the runner IPs, ask the WAF to bypass requests that carry a custom header, or lower the request rate and ramp up more slowly.

The Blocked traffic notice on a run Overview. For Vercel, the header bypass is the fix for managed runners. The IP allowlist item applies to private locations, whose egress IP you control. A seeded demo run, not a real Vercel block.

For a Vercel target, check these in order:

  1. The bypass secret is bound and the header name is spelled x-vercel-protection-bypass.
  2. You redeployed after changing the secret in Vercel.
  3. Attack Mode is off.
  4. The ramp is gradual and the rate is below what Vercel has agreed to.