← Back to Blog
News

Instant CMS Previews with Next.js draftMode and Edge Caches

By Matthew MotorsJanuary 13, 2026

Instant CMS Previews with Next.js draftMode and Edge Caches

Instant editorial previews are no longer a luxury—they’re a requirement for modern content teams running headless stacks. This guide explains how to deliver near-instant previews using Next.js draftMode and edge caching, with integration details for Strapi and Contentful, plus practical advice on authentication, visibility, cache invalidation, and editor troubleshooting.

Why instant previews matter

Preview latency directly affects editorial throughput and publish quality. Industry research shows performance and business outcomes are linked: improving site speed can reduce bounce rates and lift conversions. For example, guidance from Google’s Core Web Vitals emphasizes fast rendering (e.g., Largest Contentful Paint under 2.5 seconds) as a key user experience metric (source), and a Deloitte study found that faster mobile speed correlated with increased conversions (source). While those stats focus on public traffic, the editorial workflow benefits in the same way: sub-second previews keep teams focused and confident.

From static rebuilds to modern headless previews

Early JAMstack sites often relied on full rebuilds to reflect draft changes, which made previews slow and unpredictable. Today, the combination of headless CMS APIs, on-demand revalidation, and globally distributed edge caches allows instant previewing without compromising cache efficiency for public traffic. If you’re exploring architecture decisions, see this overview of the JAMstack approach.

Implementing instant previews: the moving pieces

At a high level, the architecture looks like this: a preview link in your CMS routes to a Next.js preview endpoint; that endpoint enables draftMode, sets a secure cookie, validates the user/token, fetches draft content from your CMS’s preview API, and renders an uncached page. Webhooks handle cache invalidation for the live site when content is published.

draftMode

In Next.js (App Router), draftMode provides a framework-native way to fetch draft content and bypass caching for the current session. When enabled, you can disable caching on data requests and conditionally show draft content to authenticated users. See the official docs for details and code patterns (source).

Next.js

Next.js combines server components, streaming, and granular caching controls to deliver fast previews without sacrificing production performance. Use React Server Components for data proximity, Route Handlers for secure preview activation, and on-demand revalidation to keep public content fresh. Explore service capabilities around Next.js here: Next.js development. For caching fundamentals, see Next.js caching guidance (source).

edge caching

Edge caching places content close to users globally, reducing time to first byte (TTFB). Public pages should be highly cacheable with headers such as Cache-Control: public, s-maxage=... and optionally stale-while-revalidate. Preview routes must bypass those caches. For background, review Vercel Edge Network caching (source) and HTTP cache directives (MDN).

previews

A preview is a user-specific, non-indexable view of draft content. It should require authentication, be omitted from sitemaps, include <meta name="robots" content="noindex, nofollow">, and set cache-bypassing headers. When the preview cookie is present, render draft data; otherwise, serve the cached public version.

headless CMS

In a headless model, the CMS exposes content via APIs. This separation enables flexible delivery to websites, apps, and devices. It also makes instant previews practical: the frontend asks the CMS preview endpoint for the latest draft with no publish required. If you’re evaluating architectures, this primer on JAMstack and headless provides context.

Strapi

Strapi supports Draft & Publish and webhooks. A typical preview flow is: create a secure Next.js /api/preview route that calls draftMode().enable(), validate a token or signed parameter, then redirect to the slug with ?preview=true. Fetch draft content from Strapi using the preview (unpublished) entries for the authenticated session. Configure Strapi webhooks to trigger on publish/update events and call your revalidation endpoint. References: Strapi webhooks (source) and preview content guide (source). For specialized implementation help, see Strapi development.

Contentful

Contentful offers a Preview API that returns draft and changed-but-unpublished entries. In your preview route, enable draftMode, validate a token, then fetch from the Contentful Preview API instead of the Delivery API. Add webhooks in Contentful to notify your Next.js revalidation endpoint when entries are published or archived. References: webhooks (source) and the Content Preview API (source).

editor experience

Editors should click a single “Preview” button in the CMS and land on the right page with their draft visible immediately. Best practices include: auto-selecting the correct locale/environment; displaying a visible “Preview Mode” banner with a link to exit; and reflecting scheduled changes (if your CMS supports them). Real-time previews increase content confidence and reduce back-and-forth with developers.

speed

For public pages, combine static generation, edge caching, and on-demand revalidation to keep pages fast worldwide. For previews, disable caching, use server components to keep data fetching close to the source, and stream the shell while data resolves. This approach balances editorial speed with production-grade performance. See Next.js revalidation patterns (source).

Authentication, visibility, and cache invalidation

  • Authentication: Use signed tokens or CMS-issued preview secrets. Validate them server-side in your Next.js Route Handler before enabling draftMode. Expire tokens and rotate keys periodically.
  • Visibility: Add noindex meta tags to preview pages, exclude them from sitemaps, and guard preview routes with auth checks. Keep previews separate from public caching layers.
  • Cache invalidation: Use CMS webhooks to call a protected Next.js endpoint that triggers on-demand revalidation. In the App Router, consider tagging fetches and using revalidateTag for granular cache busting. Docs: on-demand revalidation (source).

Example architecture (Strapi or Contentful)

  1. CMS Preview Button: Configured to hit https://your-site.com/api/preview?secret=XYZ&slug=/path.
  2. Next.js Preview Route: Validates secret, calls draftMode().enable(), sets a secure cookie, and redirects to /path?preview=true.
  3. Page Load in Preview: Server component detects draft mode; fetches from Strapi unpublished entries or Contentful Preview API; sets Cache-Control: private, no-store.
  4. Publish Event: CMS webhook calls /api/revalidate with identifiers (e.g., tags, slugs). Next.js revalidates affected paths or cache tags.

Troubleshooting tips for editors

  • If the preview looks stale, confirm you’re in preview mode and reload with ?preview=true. Ensure the “Preview Mode” banner is visible.
  • Check you’re editing the correct locale/environment. Mismatches often cause “missing changes.”
  • Verify you’re using the Preview API (Contentful) or draft content (Strapi). If you see published content only, the data source is likely the live API.
  • Clear site data or exit and re-enter preview mode if a cookie issue is suspected.
  • If a published change isn’t live, confirm the webhook fired and the revalidation endpoint returned a 200 response.

Security notes

  • Protect preview endpoints with secrets and rate limiting. Avoid exposing draft identifiers in client-side code.
  • Ensure preview pages send noindex and are not linked from public navigation.
  • Log preview activations and webhook calls to aid auditing and incident response.

Outcome: instant, safe previews with a global cache

By combining Next.js draftMode for user-specific, uncached previews with robust edge caching for public traffic, teams get the best of both worlds: confident, real-time editorial work and fast, SEO-friendly pages at scale. To explore implementation options or plan a migration, review resources on Next.js, JAMstack, and Strapi development.