<p><img src="https://matomo.blazingcdn.com/matomo.php?idsite=1&amp;rec=1" style="border:0;" alt=""> Cloudflare Vercel Workflow: Deploying NextJS with Edge Caching

Cloudflare + Vercel in 2026: The Fastest Next.js Deployment Workflow With Edge Caching

Deploy Next.js on Vercel With Cloudflare: 2026 Edge Caching Playbook

A single misconfigured cache-control header cost one SaaS team 340 ms of added TTFB across every dynamic route for eleven days before anyone noticed. The culprit was a conflict between Vercel's default stale-while-revalidate behavior and a Cloudflare cache rule that treated all 200 responses as cacheable for four hours. If you deploy Next.js on Vercel with Cloudflare sitting in front, this class of silent regression is your most likely failure mode in 2026. This article gives you the full production playbook: DNS and proxy wiring, cache-rule architecture that respects ISR and Server Actions, header-conflict resolution, a diagnostics-and-rollback checklist, and the monitoring thresholds that catch regressions before your users do.

Next.js deployment workflow with Cloudflare edge caching and Vercel origin

Why Deploy Next.js on Vercel With Cloudflare in 2026

Vercel's edge network is optimized for Next.js, but it serves a single purpose: hosting and serverless compute. Cloudflare occupies a different layer. By placing Cloudflare's proxy in front of Vercel, you gain independent control over cache TTLs per path, a global Anycast network with over 310 cities as of Q1 2026, and policy enforcement (rate limiting, bot management, custom response headers) that Vercel's middleware alone cannot replicate at the network edge.

The performance payoff is measurable. Teams running this dual-layer architecture consistently report p50 TTFB under 60 ms for static and ISR pages when Cloudflare returns a cache HIT, compared with 120–180 ms when requests pass through to Vercel's origin functions. For globally distributed audiences, the delta widens further.

Architecture Overview: What Sits Where

Clarity on responsibility boundaries prevents most configuration mistakes.

Layer Owner Responsibility
DNS + Proxy Cloudflare Anycast resolution, TLS termination, cache evaluation, WAF/bot rules
Edge Compute Vercel Next.js middleware, edge functions, ISR revalidation
Origin Compute Vercel SSR, Server Actions, API routes, serverless function execution
Static Assets Vercel (served), Cloudflare (cached) JS/CSS bundles, images, fonts — immutable content-hashed files

Step-by-Step: Wiring Cloudflare to Vercel for Next.js

1. DNS and Proxy Configuration

Point your domain's CNAME to cname.vercel-dns.com with Cloudflare's proxy enabled (orange cloud). In Vercel's dashboard, add the custom domain and verify it. As of early 2026, Vercel requires you to enable the "Verified Proxy" integration under Settings → Security. This tells Vercel to trust Cloudflare's connecting IP range and not reject proxied requests or serve challenge pages. Skip this step and you will see intermittent 403 responses.

2. TLS Mode

Set Cloudflare's SSL/TLS mode to Full (Strict). Vercel provisions certificates automatically. Using Flexible mode breaks POST requests and Server Actions because Vercel's origin expects HTTPS.

3. Cache Rules — The Part Most Teams Get Wrong

Cloudflare's default behavior is to respect origin cache-control headers. Vercel sets nuanced headers per route type. The danger is overriding them with broad Cloudflare cache rules. Here is a route-type-aware rule set that works for most Next.js apps in 2026:

Route Pattern Cloudflare Cache Rule Rationale
/_next/static/* Cache Everything, Edge TTL 30 days Content-hashed, immutable. Long TTL is safe.
/images/*, /fonts/* Cache Everything, Edge TTL 7 days Static media. Purge on redeploy if filenames change.
ISR pages (e.g., /blog/*) Respect Origin, do NOT override TTL Vercel sends s-maxage + stale-while-revalidate. Overriding breaks ISR.
/api/*, Server Actions Bypass Cache Dynamic, user-specific, often mutating. Must not be cached.
SSR pages with auth Bypass Cache Personalized content. Caching leaks data between users.

The critical rule: never set a Cloudflare Edge TTL on ISR routes. Vercel's ISR machinery uses the stale-while-revalidate window to serve cached content while regenerating in the background. If Cloudflare holds a stale copy past that window, users see outdated content and the revalidation callback never triggers.

4. Cache-Control Header Conflicts

Vercel's Next.js integration (as of v15.2, shipping mid-2026) sets these default headers on ISR responses: s-maxage={revalidate}, stale-while-revalidate=31536000. Cloudflare respects s-maxage when no override rule exists. But if your Cloudflare cache rule sets "Edge TTL" explicitly, that value takes precedence. This is where the 340 ms regression from the opening paragraph originated. Audit your rules with the cf-cache-status and age response headers. A HIT with an age exceeding your ISR revalidation interval means Cloudflare is overriding Vercel's intended behavior.

Diagnostics and Rollback Checklist

This section is what separates a blog post from a production runbook. When something breaks after enabling Cloudflare in front of Vercel, run through this sequence:

Symptom: Stale content after redeployment

Check cf-cache-status. If HIT, purge the specific URL or use Cloudflare's prefix purge. Verify that Vercel's x-vercel-cache header returns STALE or MISS after deploy — if it returns HIT, the stale object is in Vercel's cache, not Cloudflare's. Purge both layers.

Symptom: 403 or 409 on preview deployments

Preview URLs (*.vercel.app) bypass your custom domain. Cloudflare is not involved. If 403s appear on preview URLs, check Vercel's Deployment Protection settings. If they appear on the custom domain, confirm the Verified Proxy integration is active.

Symptom: ISR pages never revalidate

Cloudflare is likely caching the response past its s-maxage. Remove any Edge TTL override for the affected path. After correcting, watch the age header over successive requests to confirm it resets after the revalidation interval.

Rollback procedure

To remove Cloudflare from the path without DNS propagation delay, toggle the proxy status to DNS-only (grey cloud) for the CNAME record. Traffic flows directly to Vercel within seconds. This is your emergency eject button. Practice it before you need it.

Monitoring Thresholds That Catch Regressions

Instrument these five signals. Set alerts on them. Review weekly at minimum.

  • Cache HIT ratio (Cloudflare Analytics): Target above 85% for static assets, 50–70% for ISR routes. A sudden drop indicates a cache rule change or a deploy that altered URL structures.
  • p95 TTFB (Vercel Analytics or RUM): Baseline after enabling Cloudflare. A 2026-era target is under 200 ms globally for cached pages.
  • Revalidation callback rate (Vercel function invocations): If ISR revalidations drop to zero, Cloudflare is absorbing all requests before they reach Vercel.
  • Error rate on Server Actions: POST requests are sensitive to proxy misconfiguration. Monitor 4xx and 5xx rates on /api and action endpoints separately.
  • Bandwidth origin vs. edge: The ratio of Cloudflare-served bytes to Vercel-served bytes quantifies caching effectiveness. For a content-heavy site, expect 80%+ served from Cloudflare's edge.

When You Outgrow This Architecture

The Cloudflare-in-front-of-Vercel pattern works well up to moderate scale. At high traffic volumes — think tens of terabytes of monthly transfer — the economics shift. Cloudflare's free and Pro tiers impose soft limits on cache purge rates and rule counts. Vercel's bandwidth pricing, while bundled into its plans, becomes material past the included allocation. At that point, separating concerns further makes sense: keep Vercel for compute and deploy your static and media assets through a dedicated CDN optimized for throughput and cost per GB. BlazingCDN fits this role well, delivering fault tolerance and uptime on par with CloudFront at a fraction of the cost — starting at $4 per TB for lower volumes and scaling down to $2 per TB at 2 PB+, with 100% uptime SLA and flexible configuration. For teams pushing serious bandwidth, the savings compound fast.

FAQ

How do I deploy Next.js on Vercel with Cloudflare without breaking ISR?

Set your Cloudflare cache rules to "Respect Origin" for all ISR paths. Do not set an explicit Edge TTL. Vercel's s-maxage and stale-while-revalidate headers must pass through to Cloudflare untouched, or the background regeneration cycle breaks silently.

Do I need Cloudflare's "Verified Proxy" setting enabled on Vercel?

Yes. As of 2026, Vercel uses this integration to whitelist Cloudflare's IP ranges. Without it, Vercel may intermittently reject proxied requests with 403 errors, especially under high concurrency.

Can I use Cloudflare's cache reserve or tiered caching with Vercel?

You can. Tiered caching reduces origin pulls by routing cache misses through upper-tier Cloudflare data centers first. Cache Reserve persists objects in R2-backed storage. Both reduce load on Vercel functions. Test carefully with ISR routes to ensure revalidation timing is not extended beyond your acceptable staleness window.

What cache-control headers does Vercel set for Next.js static assets?

For content-hashed assets under /_next/static, Vercel sets public, max-age=31536000, immutable. These are safe to cache aggressively at any layer. Non-hashed assets like public/ directory files receive shorter TTLs and should be audited individually.

How do I purge cached content across both Cloudflare and Vercel after a deploy?

Vercel automatically invalidates its edge cache on each deployment for static and SSR routes. Cloudflare does not know about Vercel deploys. Use Cloudflare's API to trigger a prefix purge on deploy via a post-deploy webhook, or use cache tags if you are on an Enterprise plan. Automating this step is non-optional for production.

Should I disable Vercel's edge caching if Cloudflare is in front?

No. The two caches serve different purposes. Vercel's edge cache sits closest to the compute origin and handles ISR revalidation semantics. Cloudflare's cache sits closest to the user and handles global distribution. Disabling either one leaves a gap the other does not fully cover.

What to Do This Week

Pick one ISR route on your production site. Curl it five times from two different regions. Record the cf-cache-status, age, and x-vercel-cache headers on every response. Plot the age value over time and verify it resets at your configured revalidation interval. If it does not, you have a Cloudflare rule override in place. Fix it, re-test, and you have just eliminated the most common latency regression in this stack. Then instrument the five monitoring thresholds above and set alerts. That is a one-afternoon project that prevents the next eleven-day silent regression.