Contact
EngineeringNov 9, 2026·30 min read

Headless WordPress with Next.js: Caching, Previews and Outages, Tested

KT
Keplaris TeamNov 9, 2026
A black three-drawer cabinet on cream, a blue line of light carrying three frosted glass cards, one ringed in mint green, to a frosted glass slab

Headless WordPress with Next.js works like this: WordPress stays the editor, Next.js fetches posts from the WordPress REST API or WPGraphQL, renders and caches the pages, and a publish webhook tells Next.js which cached post to drop. In our local test on Next.js 16.4.5, pages Next.js had already cached kept serving browsers and Googlebot while a replay of the WordPress API hung, refused connections or returned 503. A post it had never cached failed for all three user agents we sent. It returned a 500 with Cache Components off, the previous caching model, and a 200 holding only a loading placeholder with Cache Components on, the setting a new create-next-app project starts with.

Keplaris is a New York product engineering studio. We design and build SaaS products, Shopify and WordPress sites, APIs and AI automation, and Next.js is our default frontend for SaaS products. This post reports a local test we ran, not a client project; the scripts and unedited output are at the end. Our own WordPress work is on our WordPress & Custom Web page.

Headless WordPress with Next.js: the short answer

In headless WordPress with Next.js, WordPress stays the editor, Next.js renders and caches every public page from the WordPress REST API or WPGraphQL, and a publish webhook tells Next.js which cached data to drop. Some teams call it decoupled WordPress; the wiring is the same. The build goes in five steps, each covered below:

  1. Choose the WordPress REST API or WPGraphQL.
  2. Fetch and cache each read with a tag, so one post can be dropped alone.
  3. Add the publish webhook that calls revalidateTag.
  4. Add Draft Mode with a WordPress credential for previews.
  5. Move SEO, images and redirects into Next.js.

What the test showed, locally on Next.js 16.4.5 with a 30-second window and a 5-second fetch timeout we set:

  • Revalidation happens on the next request, not at the webhook. The WordPress replay received no request during any webhook call; the first visitor afterwards triggered the refetch.
  • 'max' serves the old page once. With Cache Components on and off, the first visitor after a 'max' webhook got the old title and the second got the new one.
  • { expire: 0 } depended on the caching model. With Cache Components off, the first request got the new title. With Cache Components on, it got the copy from next build, which after an unpublish meant a 200 for a post the origin no longer published.
  • Cached pages survived the outage for browsers and Googlebot, uncached ones did not. With Cache Components on, a Bingbot user agent got a placeholder page for a stale post, and a page past the 5-minute expire we set returned a 500 to a browser.
  • Draft Mode shows drafts only with a credential. The cookie alone showed the published title.
  • Redirects copied with WordPress's trailing slash ended in a 404. Next.js strips the slash before it checks redirects(), so write each source without it.

Whether to go headless at all is a separate decision, covered in WordPress vs a headless CMS, whose rule is to choose headless WordPress when "your editorial team is WordPress-native but the front end is a product". This guide starts after that decision.

WPGraphQL vs the WordPress REST API: which to use with Next.js

Use the WordPress REST API when you want no extra plugin, and WPGraphQL when one page needs a post, its author and its terms in a single request. The REST API comes with WordPress. WPGraphQL is a free plugin, at version 2.26.2 on its plugin page on 2026-11-09, and the page says "WPGraphQL is becoming a Canonical Plugin on WordPress.org".

We fetched the same post both ways from the public WPGraphQL demo site, demo.wpgraphql.com, which exposes both /wp-json/wp/v2/posts and /graphql. Each request asked for what a post page needs: title, content, author name and category names. Run 1, 2026-11-09:

How the page's data was fetchedHTTP requestsResponse bytes (JSON as received)cache-controlx-cache
REST: the post by slug, then its author, then its categories35,151 + 735 + 2,102 = 7,988max-age=600, must-revalidate on all threeHIT: 1 on all three
REST with _embed=author,wp:term17,728max-age=600, must-revalidateHIT: 1
REST with _embed and _fields=title,content,_links,_embedded16,815max-age=600, must-revalidateHIT: 1
WPGraphQL query sent as GET13,624max-age=600, must-revalidateHIT: 1
WPGraphQL query sent as POST13,624nonenone

Both APIs returned the same title, author and category names. The POST query came back with no cache-control header, so send WPGraphQL reads as GET if anything between Next.js and WordPress is meant to cache them.

The WordPress REST APIWPGraphQL
InstallPart of WordPressA plugin to install and update
Payload control_fields trims fields; _embed pulls linked resources wholeExactly the fields in the query
DraftsApplication Passwords over Basic auth (tested against our replay)Not tested by us
SEO plugin fieldsYoast adds yoast_head_json to REST responsesNot checked by us

Our pick rules:

  • Pick the REST API for a blog or marketing site whose pages read one post type; two extra requests cost little once Next.js caches the page.
  • Pick WPGraphQL when pages join several types (a post with its author, terms, related posts and a menu), or you want query-level payload control.
  • Either way, cache in Next.js. The API's request count then matters only on cache misses and regenerations.

How Next.js caches WordPress content: two models

Next.js 16 has two caching models: the previous one, where each fetch carries next: { revalidate, tags }, and Cache Components, where functions marked 'use cache' set cacheLife and cacheTag. A new create-next-app project on Next.js 16.4.5 starts with Cache Components on, as the Next.js caching docs say: "New App Router apps created with the recommended create-next-app defaults already have Cache Components and Partial Prefetching enabled."

So we built the same blog twice. The test output calls them A and B:

  • Build A, Cache Components off. cacheComponents: false, and each WordPress read is a fetch with next: { revalidate: 30, tags: [...] }.
  • Build B, Cache Components on, the scaffold's default. Each read is a function marked 'use cache' with cacheLife and cacheTag.

The post read with Cache Components off, from lib/wp.ts (the Draft Mode branch is in the Draft Mode section):

async function wp<T>(path: string, init: RequestInit & { next?: { revalidate?: number; tags?: string[] } }): Promise<T> {
  // Every WordPress call gets a timeout, so a hung origin cannot hold a render forever.
  const res = await fetch(WP + path, { ...init, signal: AbortSignal.timeout(5000) });
  if (!res.ok) throw new Error(`WordPress returned ${res.status} for ${path}`);
  return res.json() as Promise<T>;
}

// ... inside getPost(slug), after the Draft Mode branch:
  const posts = await wp<Post[]>(`/wp-json/wp/v2/posts?slug=${s}&${FIELDS}`, {
    next: { revalidate: 30, tags: [`post-${slug}`] },
  });

The post read with Cache Components on:

export async function getPost(slug: string): Promise<(Post & { fetchedAt: string }) | null> {
  "use cache";
  // stale under 30 s would keep this out of the prerender, so stale is 30, not 0.
  cacheLife({ stale: 30, revalidate: 30, expire: 300 });
  cacheTag(`post-${slug}`);
  // ... then the same fetch, without next options, plus the Draft Mode branch

The 30-second window is a test setting; a real site would use minutes or hours and rely on the webhook. With Cache Components on, 30 seconds stale and 5 minutes expire are the lowest values that keep the post in the prerender, per the cacheLife reference. next build showed the difference, run 1:

1 A | Route (app)                       Revalidate  Expire
1 A |   ├ ● /blog/wordpress-7-2-beta-4         30s      1y
1 B | Route (app)                       Revalidate  Expire
1 B |   ├ ○ /blog/wordpress-7-2-beta-4         30s      5m

With Cache Components off, pages expire after a year by default; with them on, after the 5 minutes we set. That line decides what a long WordPress outage looks like.

We tested revalidation, previews and a WordPress outage on Next.js

Method. This is a local test on one laptop, not production, client or Keplaris product data, and the origin is not WordPress. Each run pulls the 4 newest WordPress.org News posts over the REST API and serves them from origin.mjs, a local replay at the same REST paths that can edit, draft or unpublish a post, hang, refuse connections or return 503. generateStaticParams prerenders 3 posts; the 4th is the never-cached one. Both builds ran with next build and next start, as the ISR guide advises ("next build and then next start"), with AbortSignal.timeout(5000) on every WordPress fetch and a fresh build copy per scenario. The test ran three times on 2026-11-09; the scenario list is in the appendix.

Revalidation, measured

After a webhook, Next.js 16.4.5 refetched from WordPress on the next page request, never during the call. With 'max', the first visitor got the old title with Cache Components on and off. With { expire: 0 }, revalidatePath or the deprecated one-argument call, Cache Components off served the new title at once, and Cache Components on served the next build copy once.

Next.js 16.4.5, local test, run 1, one row per call. "First request" is the first visitor after the webhook, or for time-based revalidation the first after the window. Times are on loopback, with the range across the three runs in brackets:

Revalidation callCache Components off: first requestCache Components off: next requestCache Components on: first requestCache Components on: next request
Time-based, 30 s window, edit at t = 10 srequest at t = 31 s: old title, STALE, 17 ms (7 to 17)t = 32 s: new title, HITrequest at t = 31 s: old title, STALE, 21 ms (19 to 35)t = 32 s: new title, HIT
revalidatePath('/blog/<slug>')new title, MISS, 16 ms (16 to 33)new, HITbuild-time copy (old title), no cache header, 27 ms (27 to 40)new, HIT
revalidateTag(tag, 'max')old title, STALE, 41 ms (6 to 41)new, HITold title, STALE, 16 ms (6 to 22)new, HIT
revalidateTag(tag, { expire: 0 })new title, MISS, 26 ms (17 to 36)new, HITbuild-time copy (old title), no cache header, 33 ms (29 to 33)new, HIT
revalidateTag(tag), deprecatednew title, MISS, 20 ms (16 to 23)new, HITbuild-time copy (old title), no cache header, 34 ms (25 to 42)new, HIT

Every status, title and cache header was the same in all three runs. The replay received 0 requests during each of the 54 webhook calls, and 1 on the first page request after each. Time-based revalidation cost one stale visitor, as the ISR guide describes ("the next request will still return the cached (now stale) page").

The build-time copy is the result to watch. In our run on Next.js 16.4.5 with Cache Components on, that first response had no x-nextjs-cache header, x-nextjs-postponed: 1, cache-control: private and the build's render time, and its saved body did not contain "Edited title". It happened 6 times per run, never with Cache Components off. The appendix traces one case.

What this test does not show

  • Loopback timings on one Apple M1 Max; a real network adds latency.
  • One next start instance per scenario with the default cache, except the two-instance case. No shared cache handler.
  • No CDN or hosting platform. Vercel, Netlify and WP Engine each add a cache layer we did not test.
  • A replay, not WordPress. We did not run WordPress, the mu-plugin or WPGraphQL, so we name no tested WordPress version.
  • Bots are user agent strings we sent, not real crawler visits.
  • Short test windows: 30 seconds to revalidate, 5 minutes to expire.
  • One Next.js version. Rerun after an upgrade.
  • No root cause for the build-time copy. We did not trace it to a line of Next.js code.

On-demand revalidation: the WordPress webhook and revalidateTag

On-demand revalidation means WordPress tells Next.js which cached post changed, instead of waiting for a time window to run out. Since Next.js 16, revalidateTag takes a second argument: 'max' serves the old page once while it refreshes, and { expire: 0 } is documented to make the next visitor wait. The revalidateTag reference says of { expire: 0 }: "Stale content is never served, so the next request is a blocking revalidate/cache miss". In our run on Next.js 16.4.5 that held with Cache Components off. With them on, the first request got the copy from next build (table above).

The route handler that ran in both builds checks the secret before it reads the body, answers as soon as the tag is marked, and never touches WordPress itself:

import { revalidatePath, revalidateTag } from "next/cache";
import { secretMatches } from "@/lib/secret";

// Called by the WordPress mu-plugin. updateTag is for Server Actions only, so a webhook
// that needs the next visitor to see fresh data passes { expire: 0 } instead.
export async function POST(request: Request) {
  if (!secretMatches(request.headers.get("x-revalidate-secret"), process.env.REVALIDATE_SECRET)) {
    return Response.json({ ok: false }, { status: 401 });
  }
  const { mode, slug } = await request.json();
  if (typeof slug !== "string" || !/^[a-z0-9-]+$/.test(slug)) {
    return Response.json({ ok: false, error: "bad slug" }, { status: 400 });
  }
  const tag = `post-${slug}`;
  switch (mode) {
    case "path":
      revalidatePath(`/blog/${slug}`);
      break;
    case "tag-max":
      revalidateTag(tag, "max");
      break;
    case "tag-expire0":
      revalidateTag(tag, { expire: 0 });
      break;
    case "tag-single":
      // @ts-expect-error deprecated single-argument form, called on purpose to test the docs line
      revalidateTag(tag);
      break;
    default:
      return Response.json({ ok: false, error: "bad mode" }, { status: 400 });
  }
  return Response.json({ ok: true, mode, tag });
}

Three rules from the test and the docs:

  • Check the secret first, in constant time, before parsing the JSON. That is the order our webhook guide uses: "Verify before you deduplicate, so a forged request never writes a key." A wrong secret got 401, and the next visitor still saw the old title.
  • Answer fast. The calls took 5 to 46 ms on loopback and made no origin request, because "A revalidation is triggered by a request, not by the revalidateTag call", as the reference says. That fits the rule in our webhook guide: "Return a 2xx as soon as the event is stored durably, and process it afterwards."
  • Duplicates are harmless. The same body sent twice returned 200 both times, and the next request made 1 origin request.

updateTag can only be called from Server Actions, so a WordPress webhook, which arrives at a route handler, has to use revalidateTag. The updateTag reference says it "can only be called from within Server Actions. It cannot be used in Route Handlers".

Which tag and profile each WordPress event should send

Tag each cached read by what it depends on, so one edit drops only the pages that show it. A single site-wide tag makes every edit refresh every page.

WordPress eventTags to revalidateProfile we would send
Publish or update a postpost-<slug>, and posts if a listing shows it'max'
Unpublish or trash a postpost-<slug> and posts{ expire: 0 }
Slug changethe old slug's tag and the new one{ expire: 0 } for the old slug
Rename a category or tagterm-<id>'max'
Change an author's name or bioauthor-<id>'max'
Change a menumenu'max'

We tag posts by slug because a fetch tag has to be known before the request. The test exercised only the post tag; the other rows are the scheme we would use.

Unpublishing is where the profile matters most. After an unpublish and a { expire: 0 } webhook, Cache Components off returned 404 at once. Cache Components on returned 200 with the build-time copy first, then 404, and that first response is the one you least want a crawler to get. With 'max', both would serve the removed post once by design, so the mu-plugin below sends { expire: 0 } for anything leaving "publish".

The mu-plugin that sends the webhook

The transition_post_status hook "Fires when a post is transitioned from one status to another", and a user note on its reference page says it also fires when a post is updated without a status change. This mu-plugin skips autosaves and revisions, sends 'max' for anything published and { expire: 0 } for anything leaving "publish", and uses post_updated to catch a slug change. It passed a PHP syntax check; we did not run it against WordPress, so treat it as a starting point:

<?php
/**
 * Plugin Name: Next.js revalidation webhook
 * Description: Tells the Next.js front end which cached post to drop. Shown in our post, not run in our test.
 */

// Define both in wp-config.php.
// define( 'NEXTJS_REVALIDATE_URL', 'https://www.example.com/api/revalidate' );
// define( 'NEXTJS_REVALIDATE_SECRET', 'a long random string' );

function kep_nextjs_revalidate( $mode, $post_id, $slug ) {
	wp_remote_post(
		NEXTJS_REVALIDATE_URL,
		array(
			'timeout'  => 3,
			'blocking' => false,
			'headers'  => array(
				'Content-Type'        => 'application/json',
				'x-revalidate-secret' => NEXTJS_REVALIDATE_SECRET,
			),
			'body'     => wp_json_encode(
				array(
					'mode' => $mode,
					'id'   => $post_id,
					// WordPress can append __trashed to a trashed post's slug.
					'slug' => preg_replace( '/__trashed$/', '', $slug ),
				)
			),
		)
	);
}

// Publish, update, unpublish and trash. Fires on updates even when the status stays "publish".
add_action(
	'transition_post_status',
	function ( $new_status, $old_status, $post ) {
		if ( 'post' !== $post->post_type || wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
			return;
		}
		if ( 'publish' === $new_status ) {
			kep_nextjs_revalidate( 'tag-max', $post->ID, $post->post_name );
		} elseif ( 'publish' === $old_status ) {
			// Leaving "publish": drop it now, so no visitor gets the old page again.
			kep_nextjs_revalidate( 'tag-expire0', $post->ID, $post->post_name );
		}
	},
	10,
	3
);

// A slug change: the old URL's cache has to go too.
add_action(
	'post_updated',
	function ( $post_id, $post_after, $post_before ) {
		if ( 'publish' === $post_before->post_status && $post_before->post_name !== $post_after->post_name ) {
			kep_nextjs_revalidate( 'tag-expire0', $post_id, $post_before->post_name );
		}
	},
	10,
	3
);

'blocking' => false keeps a slow front end from slowing the editor's save, but WordPress never learns whether the call failed. If a missed webhook matters, call from a background job and log the response, or keep a time-based revalidate as the backstop, as both our builds do.

What your site serves when WordPress is down

In our local Next.js 16.4.5 test, a page Next.js had already cached kept serving its last good version to browsers and Googlebot while the WordPress API replay hung, refused connections or returned 503. A post it had never cached returned a 500 with Cache Components off, and a 200 holding only the loading placeholder with Cache Components on, for browser, Googlebot and Bingbot user agents.

For each origin state, the test requested a page inside its 30-second window, one past it and one never requested, as a browser, Googlebot and Bingbot in that order. Next.js 16.4.5, local test, run 1, WordPress API replay hanging, behind the 5-second fetch timeout we chose:

Caching model, pageBrowser user agentGooglebot user agentBingbot user agent
Cache Components off, cached, fresh200, page, 12 ms200, page, 4 ms200, page, 17 ms
Cache Components off, cached, stale200, page (STALE), 30 ms200, page (STALE), 5 ms200, page (STALE), 5 ms
Cache Components off, never cached500, 5,047 ms500, 5,052 ms500, 5,033 ms
Cache Components on, cached, fresh200, page, 14 ms200, page, 4 ms200, page, 11 ms
Cache Components on, cached, stale200, page (STALE), 28 ms200, page, 3 ms200, placeholder only, 5,031 ms
Cache Components on, never cached200, placeholder only, 5,036 ms200, placeholder only, 5,018 ms200, placeholder only, 5,024 ms

"Page" means the post with its title; "placeholder only" means the HTML held the Suspense fallback text, "Loading post", and no post.

With the replay refusing connections or returning 503, every cell matched in all three runs, and nothing waited for the timeout: the slowest request took 47 ms.

The placeholder page returns 200, with cache-control: private and no noindex, and we would rate it worse for search than the 500. Google's HTTP status and network errors doc says a 5xx makes its crawlers "temporarily slow down" and keeps already indexed URLs for a while, while a page whose content suggests "an empty page or an error message" can be reported as a soft 404.

After recovery, the never-cached post rendered on the next request in both builds, but the stale page did not refresh straight away. The ISR guide says that after a failed revalidation "the last successfully generated data will continue to be served from the cache. On the next subsequent request, Next.js will retry revalidating the data." The first part held. The retry came later than "the next subsequent request". In 16.4.5 a failed regeneration stores the old page again with a revalidate window of at most 30 seconds (retainPreviousCacheEntry in the response cache, commented "delay retries after revalidation fails"). So the requests 1 to 2 seconds after recovery were HITs with the old page. In a separate probe on both builds, the request 32 seconds after the failure was STALE, reached the replay, and the next request had the fresh page.

Googlebot and Bingbot take different paths under Cache Components. Next.js 16.4.5 treats Bingbot as an HTML-limited bot and Googlebot as one that runs JavaScript, and for HTML-limited bots the caching docs say Next.js "skips the static shell, and renders the page dynamically at request time". In our run, a Bingbot user agent re-ran the WordPress fetch for the stale post, waited out the timeout and got the placeholder with a 200. Browsers and Googlebot got the stale post in milliseconds. With Cache Components off, Bingbot got what a browser got.

Put a timeout on every WordPress fetch

Without a timeout, one hung request holds a render open as long as the socket does. In the hang runs, the never-cached post returned after 5,016 to 5,075 ms, our 5,000 ms AbortSignal.timeout plus rendering. With Cache Components off, one of 4 hung requests outlived it: by elimination the background regeneration of the stale page, which stayed open until the replay recovered. No visitor waited on it. In Next.js 16.4.5, patch-fetch.js drops the signal when it refetches a stale fetch entry, which fits, though we did not trace it further. With Cache Components on, all 5 hung requests closed after about 5,000 ms. As our monolith vs microservices post puts it, "Each hop needs a timeout and a retry policy."

Long outages, restarts and builds

The outage cases above ran inside the 5-minute expire we set with Cache Components on. Three more cases go past it. Next.js 16.4.5, local test, run 1:

CaseCache Components offCache Components on
Server kept running, page generated 305 s (off) or 310 s (on) earlier, replay hangingbrowser 200, page (STALE), 8 ms; Bingbot 200, pagebrowser 500 after 5,047 ms; Bingbot 200, placeholder only, after 5,040 ms
next start restarted with the replay refusing connections, pages from next build 341 s (off) or 351 s (on) oldbrowser 200, page (STALE); Googlebot 200, page; Bingbot 200, page; never-cached post 500browser 500; Googlebot 200, page; Bingbot 200, placeholder only; never-cached post 200, placeholder only
next build from a clean checkout with the replay refusing connectionsexit 1exit 1

With Cache Components off, a page stays servable for its expire, a year by default. With Cache Components on, in our 16.4.5 run, a browser request for a page older than its cacheLife expire waited for WordPress and got a 500 when WordPress did not answer. Set expire to the longest WordPress outage you want to ride out, not to how fresh you want pages.

In the restart case, Googlebot got the page while the browser request just before it got a 500; we did not isolate why. Both clean builds failed with Error: Failed to collect page data for /blog/[slug], which is generateStaticParams failing to reach WordPress. So a deploy failed during our simulated outage, while a server already running kept serving what it had cached.

Previewing WordPress drafts with Next.js Draft Mode

Draft Mode only switches off the cache; your fetch still has to ask WordPress for the draft with a credential, or the preview shows the published post. Many headless WordPress guides still call this Preview Mode, the old Next.js name, and the Pages Router docs now say "This feature is superseded by Draft Mode."

With the cookie set, fetch() calls "skip the Next.js fetch cache", per the Draft Mode guide. WordPress returns a draft only to an authenticated request, and "As of 5.6, WordPress has shipped with Application Passwords", per its REST API authentication docs, sent with HTTP Basic auth over https.

The entry route checks the preview secret, confirms the post exists, turns Draft Mode on and redirects to the slug WordPress returned:

import { draftMode } from "next/headers";
import { redirect } from "next/navigation";
import { getPost } from "@/lib/wp";
import { secretMatches } from "@/lib/secret";

// The WordPress preview link opens /api/draft?secret=...&slug=/blog/<slug>
export async function GET(request: Request) {
  const url = new URL(request.url);
  if (!secretMatches(url.searchParams.get("secret"), process.env.PREVIEW_SECRET)) {
    return new Response("Invalid token", { status: 401 });
  }
  const slug = (url.searchParams.get("slug") ?? "").replace(/^\/blog\//, "");
  const post = await getPost(slug);
  if (!post) {
    return new Response("Invalid slug", { status: 401 });
  }
  (await draftMode()).enable();
  // Redirect to the slug WordPress returned, not the query string, so this is not an open redirect.
  redirect(`/blog/${post.slug}`);
}

And the branch inside getPost that runs when the cookie is present (from the build with Cache Components off; the build with them on has a matching branch inside its 'use cache' function):

  if (isEnabled && process.env.WP_APP_PASSWORD) {
    // Draft Mode skips the cache; the credential is what makes WordPress return the draft.
    const auth = "Basic " + Buffer.from(process.env.WP_APP_PASSWORD).toString("base64");
    const posts = await wp<Post[]>(`/wp-json/wp/v2/posts?slug=${s}&context=edit&${FIELDS}`, { headers: { authorization: auth } });
    return posts[0] ?? null;
  }

We ran the preview twice per build, with the credential set and with WP_APP_PASSWORD empty. Next.js 16.4.5, local test, run 1:

Step (run 1)Cache Components offCache Components on
Visitor, no cookie200, published title200, published title
/api/draft with a wrong secret401401
/api/draft with the right secret307 to the post, sets __prerender_bypass307 to the post, sets __prerender_bypass
With the cookie, credential set200, draft title, replay saw auth=yes200, draft title, replay saw auth=yes
With the cookie, no credential200, published title, replay saw auth=no200, published title, replay saw auth=no
Visitor, no cookie, after the preview200, published title200, published title
POST /api/draft/disable200, clears __prerender_bypass200, clears __prerender_bypass

Draft responses were private, and the preview did not leak into the cache. One debugging trap: Draft Mode responses still said x-nextjs-cache: HIT, although the replay received a fresh request for each, so check the render time or the origin log instead.

Our replay serves the stored draft to any authenticated context=edit request by slug. In WordPress, unsaved changes to a published post live in an autosave, at GET /wp/v2/posts/<id>/autosaves in the REST reference, so a production preview of an edited published post should read that by ID. We did not test autosaves or WPGraphQL draft queries.

Images from the WordPress media library

next/image only optimizes WordPress images whose host is listed in images.remotePatterns, and Next.js 16 refuses local IP addresses by default, which catches a WordPress running on localhost. The Next.js 16 upgrade guide says "A new security restriction blocks local IP optimization by default."

We asked /_next/image for three images, each at w=640&q=75. Next.js 16.4.5, local test, run 1:

Image URLListed in remotePatternsStatusResponse
http://127.0.0.1:4010/wp-content/uploads/test.jpgyes400"url" parameter is not allowed
https://wordpress.org/news/files/2026/10/Forms-Global-1.webpyes20010,806 bytes of image/jpeg, cache-control: public, max-age=315360000, must-revalidate
https://i0.wp.com/wordpress.org/news/files/2026/10/Forms-Global-1.webpno400"url" parameter is not allowed

We listed the local image in remotePatterns on purpose. Both refusals had the same body; the server log tells them apart, and for the local image it said: upstream image http://127.0.0.1:4010/wp-content/uploads/test.jpg hostname resolved to private IP ["127.0.0.1"] If this is expected and you understand SSRF risk, use images.dangerouslyAllowLocalIP = true to continue. Look for that line when images from a local WordPress fail. The wordpress.org image came back as JPEG because our request sent no Accept header for WebP or AVIF.

WordPress.org News runs Jetpack, and its post "WordPress 7.2 Beta 1" embeds https://i0.wp.com/wordpress.org/news/files/2026/10/Forms-Global-1.webp?resize=1024%2C576&#038;ssl=1, not the wordpress.org URL, so remotePatterns has to list that CDN host too. Images inside content.rendered are plain HTML, so the browser loads them straight from WordPress or its CDN unless you parse the HTML and swap them for <Image>.

An optimized image is cached for minimumCacheTTL "or the upstream image Cache-Control header, whichever is larger", per the image reference. wordpress.org sends a ten-year max-age, and the optimized copy carried it, so upload replaced images under a new file name.

Headless WordPress SEO: metadata, canonicals, redirects and sitemaps

WordPress redirect plugins stop working for visitors once Next.js serves the pages, so the redirects have to move into Next.js. The same goes for everything else an SEO plugin did in the theme. Our post on the headless Shopify SEO trap calls this "the part that quietly kills careless headless projects."

What has to move:

  • Titles, descriptions and schema. Yoast SEO adds yoast_head_json to REST responses, "the raw data, as a series of key/value pairs", per its REST API docs. Map it in generateMetadata. Our seed does not return it, so we did not test the mapping.
  • Canonicals. Every canonical points at the Next.js domain, not at the WordPress host.
  • The WordPress front end. Noindex it, or redirect it to the matching Next.js URL, so the same post does not live at two addresses.
  • Links inside post content. Links between posts in content.rendered carry the WordPress site's address, so rewrite them to Next.js paths when you render, or they send readers and crawlers to the WordPress front end. We did not test this.
  • Sitemap. Build app/sitemap.ts from the API (slugs and modified_gmt), because the WordPress sitemap lists WordPress URLs.
  • Redirects and trailing slashes. WordPress permalinks end in a slash; Next.js by default does not. The trailingSlash docs say "By default Next.js will redirect URLs with trailing slashes to their counterpart without a trailing slash."

That last point produced the most useful SEO result in the test. Our sample redirect list follows the seed posts' permalinks (https://wordpress.org/news/2026/11/wordpress-7-2-beta-4/ is one), with one rule source keeping the trailing slash and one without it. We requested both old URLs with the slash. Next.js 16.4.5, local test, run 1, Cache Components off (the build with them on gave the same statuses):

RequestWhat came back
/blog/wordpress-7-2-beta-4/308 to /blog/wordpress-7-2-beta-4
/2026/11/wordpress-7-2-beta-4/, rule source written with the trailing slash308 to /2026/11/wordpress-7-2-beta-4, then 404
/2026/10/wordpress-7-1-4/, rule source written without it308 to /2026/10/wordpress-7-1-4, then 308 to /blog/wordpress-7-1-4, then 200

Strip the trailing slash from every source in a WordPress redirect list, or set trailingSlash: true to keep WordPress's URL shape (we did not test that setting). The redirects docs say permanent: true "will use the 308 status code which instructs clients/search engines to cache the redirect forever".

The Bingbot result from the outage section belongs here too: with Cache Components on, a Bingbot user agent got a placeholder page for a stale post that browsers and Googlebot still got.

Where to run WordPress and Next.js

WordPress can stay on any PHP host that the Next.js server and your editors can reach, with the admin behind your host's access controls. Next.js needs a runtime that supports ISR. The ISR guide says "ISR is only supported when using the Node.js runtime (default)" and "ISR is not supported when creating a Static Export", so a static export loses the webhook and the time windows.

On more than one Next.js instance, a webhook refreshes only the instance it reaches, as the self-hosting guide says. Its fix is a refreshTags() method in a custom cache handler that syncs "tag state from shared storage (like Redis)". We ran two copies of each build and sent a { expire: 0 } webhook to one. That instance refreshed. The other kept the old title until its own 30-second window ran out, then served it once more as STALE before the new one.

On Vercel, the pricing page said on 2026-11-09 that "Our Hobby plan is for personal, non-commercial use", so a business site starts on Pro at $20 a month per developer seat, with a "$20 included credit" and metered ISR reads and writes. We did not test on any hosting platform.

Do you need Faust.js?

Faust.js supports the Pages Router only, as of 2026-11-09: its README lists "Next.js 12.1.6 or newer with the Pages Router", its experimental App Router package is deprecated, and WP Engine says App Router support will come in its newer Headless WordPress Toolkit. What it would add to an App Router build, the preview entry, the draft fetch and the webhook, is the few dozen lines of route handlers above. Nothing here is a reason to rewrite a working Faust.js site.

Where headless WordPress falls short

Headless WordPress means running two stacks: WordPress with its core, plugin and PHP updates, and a Next.js app with its own updates on a second host with its own bill. Someone also has to own the tags, the webhook and the timeouts, and because Next.js 16 changed revalidateTag and added Cache Components, a test like ours needs a rerun after each major upgrade.

Front-end plugins stop working. Anything a plugin renders into the theme (contact forms, comments, related posts, search, cookie banners) has to be rebuilt in Next.js or replaced with a service. Plugins that change data in the admin, such as custom fields, keep working if their data reaches the API.

Previews take work: the button works only once the entry route, the credential and the draft fetch are all in place. If those costs outweigh what a product-grade front end buys you, stay coupled and spend the effort on the theme; our custom WordPress theme vs page builder test found that choice "comes down to who edits the site and how long it has to last".

If you'd rather keep WordPress and make it fast, our WordPress & Custom Web work is lean custom themes written from scratch, with structured content models, version-controlled code and staging environments; to budget it, our WordPress developer cost guide labels published rates and project prices.

The full tutorial code and test output

This is the whole headless WordPress Next.js tutorial in runnable form: the scaffold, the two builds, the replay origin and the runner. Create a folder, scaffold one app and copy it for the second build, put the files below in place, then run the test:

npx create-next-app@latest app --yes
cp -R app app-a && cp -R app app-b
rm app-a/app/page.tsx app-a/app/globals.css app-b/app/page.tsx app-b/app/globals.css
# put origin.mjs, run.mjs and test.jpg (any small JPEG) in the folder, the shared files in shared/,
# and each build's lib/wp.ts, app/blog/[slug]/page.tsx and next.config.ts in variant-a/ and variant-b/
node run.mjs 1

run.mjs copies shared/ and the matching variant-*/ folder into each app, writes redirects.json, builds, and clones each app for the multi-server scenarios. Apart from WordPress.org News, one wordpress.org image, 8 requests to demo.wpgraphql.com and Next.js's default telemetry, the test talks only to 127.0.0.1. The runner uses macOS cp -c clones and sw_vers. A run takes about 12 minutes.

What each run measured, per build. Servers ran with NEXT_PRIVATE_DEBUG_CACHE=1. Each scenario first requests its page twice: the prerendered copy is older than the 30-second window, so the first request is served stale and regenerates it, and the second returns a page generated a second earlier.

  1. Time-based revalidation: an edit at t = 10 s, requests at 0, 5, 25, 31, 32, 35 and 62 s.
  2. On-demand revalidation with revalidatePath, revalidateTag(tag, 'max'), revalidateTag(tag, { expire: 0 }) and the deprecated revalidateTag(tag), three requests after each webhook.
  3. Webhook hygiene: a wrong secret, and the same valid call twice.
  4. Unpublish, then a { expire: 0 } webhook.
  5. A slug outside generateStaticParams.
  6. The origin hanging, refusing and returning 503, for a browser, Googlebot and Bingbot user agent, then recovery.
  7. A server that kept running while its page aged past the 5-minute expire, with the origin hanging.
  8. A restart and a next build with the origin refusing connections.
  9. Two instances, with the webhook sent to one.
  10. Draft Mode with and without the WordPress credential.
  11. Images and redirects.

Run metadata: Node v24.20.0 with --network-family-autoselection-attempt-timeout=1000 (the runner's comment explains why), Next.js 16.4.5 and React 19.3.0 from create-next-app on 2026-11-09, Turbopack, macOS 27.0.1, Apple M1 Max with 64 GB RAM. Seed: WordPress.org News posts 21907, 21896, 21890 and 21835. Across the three runs, every status, title, x-nextjs-cache value, origin request count and note in the 252 request rows each run recorded was identical, as were the image, redirect, Draft Mode, build and demo.wpgraphql.com results; only timings differed. In a trial run before these, Build A's copied folder still held an earlier fetch cache, so its outage build got past generateStaticParams and failed later. Two later starts did not finish. One failed after its first warm-up because a probe server we had started by hand still held port 3000, and we stopped the other by hand. The runner now checks its ports. The trial and aborted outputs are kept with the counted runs.

The generated next.config.ts, unchanged, from npx create-next-app@latest app --yes on 2026-11-09:

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
  cacheComponents: true,
  partialPrefetching: true,
  turbopack: {
    rules: {
      "*.css": {
        loaders: ["@tailwindcss/turbopack"],
        as: "*.css",
      },
    },
  },
};

export default nextConfig;

The replay origin, origin.mjs:

// origin.mjs: a local replay of a real WordPress.org News REST response. Not WordPress.
// Serves the seeded posts at the real REST paths on 127.0.0.1:4010 and takes control
// calls on 127.0.0.1:4011, so "refuse" can close the data port and still be switched back.
// Node 24, no dependencies. Usage: node origin.mjs seed.json (test.jpg sits next to this file)
import http from "node:http";
import fs from "node:fs";

const SEED = process.argv[2];
const DATA_PORT = 4010;
const CONTROL_PORT = 4011;
// Throwaway test credential, the shape of a WordPress Application Password (user:password).
const DRAFT_AUTH = "Basic " + Buffer.from("preview-bot:test-app-password").toString("base64");
// A 1x1 JPEG next to this file, served at /wp-content/uploads/test.jpg.
const JPEG = fs.readFileSync(new URL("./test.jpg", import.meta.url));

const t0 = Date.now();
let state;
const log = [];
const hung = new Set();

function reset() {
  const seed = JSON.parse(fs.readFileSync(SEED, "utf8"));
  state = { posts: structuredClone(seed.posts), drafts: new Map(), unpublished: new Set(), mode: "up", hits: 0 };
  log.length = 0;
}
reset();

function record(req, status, note = "") {
  state.hits++;
  const ua = (req.headers["user-agent"] ?? "-").split(" ")[0];
  const auth = req.headers.authorization ? (req.headers.authorization === DRAFT_AUTH ? "yes" : "bad") : "no";
  const line = `${Date.now() - t0} ${req.method} ${req.url} ${ua} auth=${auth} ${status}${note ? " " + note : ""}`;
  log.push(line);
}

function json(res, status, body, headers = {}) {
  res.writeHead(status, { "content-type": "application/json; charset=UTF-8", ...headers });
  res.end(JSON.stringify(body));
}

function view(post, wantDraft) {
  const draft = wantDraft ? state.drafts.get(post.id) : undefined;
  return draft ? { ...post, title: { rendered: draft.title }, status: "draft" } : post;
}

function pick(post, fields) {
  if (!fields) return post;
  return Object.fromEntries(fields.split(",").filter((f) => f in post).map((f) => [f, post[f]]));
}

function handleData(req, res) {
  const url = new URL(req.url, `http://127.0.0.1:${DATA_PORT}`);
  if (state.mode === "hang") {
    // Accept the connection and never answer. Log when the client gives up.
    const started = Date.now();
    hung.add(res);
    record(req, "hang");
    res.on("close", () => {
      hung.delete(res);
      log.push(`${Date.now() - t0} closed ${req.url} after ${Date.now() - started} ms`);
    });
    return;
  }
  if (state.mode === "503") {
    record(req, 503);
    return json(res, 503, { code: "service_unavailable", message: "Origin returned 503 (test switch).", data: { status: 503 } });
  }
  if (url.pathname === "/wp-content/uploads/test.jpg") {
    record(req, 200);
    res.writeHead(200, { "content-type": "image/jpeg", "content-length": JPEG.length });
    return res.end(JPEG);
  }
  if (url.pathname !== "/wp-json/wp/v2/posts") {
    record(req, 404);
    return json(res, 404, { code: "rest_no_route", message: "No route was found matching the URL and request method.", data: { status: 404 } });
  }
  const wantsPrivate = url.searchParams.get("context") === "edit" || (url.searchParams.get("status") ?? "").includes("draft");
  if (wantsPrivate && req.headers.authorization !== DRAFT_AUTH) {
    record(req, 401);
    return json(res, 401, { code: "rest_forbidden_context", message: "Sorry, you are not allowed to edit posts in this post type.", data: { status: 401 } });
  }
  const live = state.posts.filter((p) => !state.unpublished.has(p.id));
  const fields = url.searchParams.get("_fields");
  let out;
  if (url.searchParams.has("slug")) {
    out = live.filter((p) => p.slug === url.searchParams.get("slug"));
  } else {
    out = live.slice(0, Number(url.searchParams.get("per_page") ?? 10));
  }
  out = out.map((p) => pick(view(p, wantsPrivate), fields));
  record(req, 200);
  return json(res, 200, out, { "x-wp-total": String(live.length), "x-wp-totalpages": "1" });
}

let dataServer;
function listen() {
  dataServer = http.createServer(handleData);
  dataServer.listen(DATA_PORT, "127.0.0.1");
}
listen();

http
  .createServer((req, res) => {
    const url = new URL(req.url, `http://127.0.0.1:${CONTROL_PORT}`);
    const q = url.searchParams;
    const find = () => state.posts.find((p) => p.id === Number(q.get("id")));
    switch (url.pathname) {
      case "/__edit": {
        const post = find();
        post.title = { rendered: q.get("title") };
        post.modified_gmt = new Date().toISOString().slice(0, 19);
        return json(res, 200, { ok: true, id: post.id, title: post.title.rendered });
      }
      case "/__draft":
        state.drafts.set(Number(q.get("id")), { title: q.get("title") });
        return json(res, 200, { ok: true });
      case "/__unpublish":
        state.unpublished.add(Number(q.get("id")));
        return json(res, 200, { ok: true });
      case "/__mode": {
        const next = q.get("state");
        for (const r of hung) r.destroy();
        if (next === "refuse" && state.mode !== "refuse") {
          dataServer.close();
          dataServer.closeAllConnections();
        }
        if (next !== "refuse" && state.mode === "refuse") listen();
        state.mode = next;
        return json(res, 200, { ok: true, mode: next });
      }
      case "/__hits":
        return json(res, 200, { hits: state.hits, log });
      case "/__reset":
        for (const r of hung) r.destroy();
        if (state.mode === "refuse") listen();
        reset();
        return json(res, 200, { ok: true });
      default:
        return json(res, 404, { ok: false });
    }
  })
  .listen(CONTROL_PORT, "127.0.0.1", () => console.log(`origin up: data ${DATA_PORT}, control ${CONTROL_PORT}`));

The runner, run.mjs:

// run.mjs: headless WordPress with Next.js, measured. One local next start per build, a local
// replay of a real WordPress.org News REST response as the origin, loopback only.
// Node 24, no dependencies beyond the two Next.js apps. Usage: node run.mjs <run-number>
import { spawn, execFileSync } from "node:child_process";
import fs from "node:fs";
import net from "node:net";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";

const H = path.dirname(fileURLToPath(import.meta.url));
const RUN = process.argv[2] ?? "1";
const OUT = path.join(H, "runs", `run-${RUN}`);
fs.mkdirSync(path.join(OUT, "bodies"), { recursive: true });
const CONTROL = "http://127.0.0.1:4011";
const SECRET = "test-revalidate-secret";
const PREVIEW = "test-preview-secret";
const APP_PASSWORD = "preview-bot:test-app-password";
const UA = {
  browser: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36",
  googlebot: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
  bingbot: "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)",
};
const NEW_TITLE = "Edited title";
const DRAFT_TITLE = "Draft title";
// Our network has no IPv6 route and IPv4 connects to wordpress.org take longer than Node's
// 250 ms happy-eyeballs attempt default, so every process gets a 1,000 ms attempt timeout.
const NODE_FLAG = "--network-family-autoselection-attempt-timeout=1000";
net.setDefaultAutoSelectFamilyAttemptTimeout(1000);
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const rows = [];
const summary = [];
let seed, slugs, build, scenario, t0;

function print(line) {
  console.log(line);
}

// ---------- origin and servers ----------
async function control(p) {
  return (await fetch(CONTROL + p, { method: "POST" })).json();
}
async function hits() {
  return (await fetch(CONTROL + "/__hits")).json();
}
function startProcess(cmd, args, opts, logFile, readyText) {
  const child = spawn(cmd, args, { ...opts, stdio: ["ignore", "pipe", "pipe"] });
  const out = fs.createWriteStream(logFile);
  child.stdout.pipe(out);
  child.stderr.pipe(out);
  return new Promise((resolve, reject) => {
    let buf = "";
    const timer = setTimeout(() => reject(new Error(`not ready: ${logFile}`)), 30000);
    child.stdout.on("data", (d) => {
      buf += d;
      if (buf.includes(readyText)) {
        clearTimeout(timer);
        resolve(child);
      }
    });
  });
}
const servers = new Map();
function appDir(b, suffix = "") {
  return path.join(H, `app-${b.toLowerCase()}${suffix}`);
}
async function stopServer(port) {
  const child = servers.get(port);
  if (!child) return;
  servers.delete(port);
  await new Promise((r) => {
    child.once("exit", r);
    child.kill("SIGTERM");
  });
}
async function startServer(dir, port, env = {}, label) {
  await stopServer(port);
  return startProcess(
    path.join(dir, "node_modules/.bin/next"),
    ["start", "-H", "127.0.0.1", "-p", String(port)],
    {
      cwd: dir,
      env: { ...process.env, NODE_OPTIONS: NODE_FLAG, NEXT_PRIVATE_DEBUG_CACHE: "1", REVALIDATE_SECRET: SECRET, PREVIEW_SECRET: PREVIEW, WP_APP_PASSWORD: APP_PASSWORD, ...env },
    },
    path.join(OUT, `server-${build}-${label}-${port}.log`),
    "Ready",
  ).then((c) => (servers.set(port, c), c));
}
// Every scenario starts from a fresh copy of the pristine .next directory and a fresh origin.
async function fresh(label, env = {}, { dir = appDir(build), port = 3000, resetOrigin = true } = {}) {
  await stopServer(port);
  fs.rmSync(path.join(dir, ".next"), { recursive: true, force: true });
  execFileSync("cp", ["-Rc", path.join(dir, ".next-pristine"), path.join(dir, ".next")]);
  if (resetOrigin) await control("/__reset");
  await startServer(dir, port, env, label);
  scenario = label;
  t0 = Date.now();
}

// ---------- requests and rows ----------
// Every <h1> in the HTML, in order; a streamed response can carry more than one.
function titleSeen(html) {
  const seen = [...html.matchAll(/<h1>(.*?)<\/h1>/g)].map((m) => (m[1] === NEW_TITLE ? "new" : m[1] === DRAFT_TITLE ? "draft" : "old"));
  return seen.length ? [...new Set(seen)].join("+") : "none";
}
function renderedAt(html) {
  const seen = [...html.matchAll(/data-rendered-at="([^"]+)"/g)].map((m) => m[1].slice(11, 23));
  return seen.length ? [...new Set(seen)].join("+") : "-";
}
function row(step, ua, p, status, cache, title, rendered, delta, ms, note = "") {
  const t = ((Date.now() - t0) / 1000).toFixed(1);
  const r = { run: RUN, build, scenario, step, t_s: Number(t), ua, path: p, status, cache, title, rendered, delta, ms, note };
  rows.push(r);
  print([RUN, build, scenario, step, t, ua, p, status, cache, title, rendered, delta, ms, note].filter((x) => x !== "").join(" "));
  return r;
}
async function delta(before) {
  await sleep(150); // let a background regeneration reach the origin before counting
  return (await hits()).hits - before;
}
async function get(step, p, { ua = "browser", port = 3000, cookie, note = "" } = {}) {
  const before = (await hits()).hits;
  const start = Date.now();
  const headers = { "user-agent": UA[ua] };
  if (cookie) headers.cookie = cookie;
  const res = await fetch(`http://127.0.0.1:${port}${p}`, { headers, redirect: "manual" });
  const html = await res.text();
  const ms = Date.now() - start;
  fs.writeFileSync(path.join(OUT, "bodies", `${build}-${scenario}-${step}-${ua}-${port}.html`), html);
  const extra = res.status >= 300 && res.status < 400 ? `location=${res.headers.get("location")}` : "";
  const cc = res.headers.get("cache-control") ?? "";
  const priv = cc.startsWith("private") ? "cache-control=private" : "";
  const postponed = res.headers.get("x-nextjs-postponed") ? "postponed" : "";
  return row(step, ua, p, res.status, res.headers.get("x-nextjs-cache") ?? "-", titleSeen(html), renderedAt(html), await delta(before), ms, [extra, priv, postponed, note].filter(Boolean).join(" "));
}
async function webhook(step, mode, slug, { secret = SECRET, port = 3000 } = {}) {
  const before = (await hits()).hits;
  const start = Date.now();
  const res = await fetch(`http://127.0.0.1:${port}/api/revalidate`, {
    method: "POST",
    headers: { "content-type": "application/json", "x-revalidate-secret": secret },
    body: JSON.stringify({ mode, id: seed.posts.find((p) => p.slug === slug).id, slug }),
  });
  await res.text();
  const ms = Date.now() - start;
  return row(step, "webhook", `/api/revalidate:${mode}`, res.status, "-", "-", "-", await delta(before), ms, port !== 3000 ? `port=${port}` : "");
}
async function warm(slug, port = 3000) {
  // The prerendered page is older than its 30 s window, so the first GET is served stale and
  // regenerates in the background; the second GET returns the page generated just now.
  await get("warm1", `/blog/${slug}`, { port });
  await sleep(1000);
  return get("warm2", `/blog/${slug}`, { port });
}
async function at(s) {
  const wait = t0 + s * 1000 - Date.now();
  if (wait > 0) await sleep(wait);
}
const edit = (slug) => control(`/__edit?id=${seed.posts.find((p) => p.slug === slug).id}&title=${encodeURIComponent(NEW_TITLE)}`);
const scen = (label) => rows.filter((r) => r.build === build && r.scenario === label);

// ---------- scenarios ----------
async function s1() {
  await fresh("s1-window");
  await warm(slugs.a);
  t0 = Date.now();
  for (const s of [0, 5, 10, 25, 31, 32, 35, 62]) {
    await at(s);
    if (s === 10) {
      await edit(slugs.a);
      print(`${RUN} ${build} s1-window edit ${((Date.now() - t0) / 1000).toFixed(1)} origin title changed`);
    } else await get(`t${s}`, `/blog/${slugs.a}`);
  }
  const first = scen("s1-window").find((r) => r.title === "new");
  summary.push(`${build} s1 time-based: first title_seen=new at t=${first?.t_s ?? "never"} (${first?.cache ?? "-"}); edit at t=10, page generated at warm2`);
}

async function s2() {
  for (const mode of ["path", "tag-max", "tag-expire0", "tag-single"]) {
    await fresh(`s2-${mode}`);
    await warm(slugs.a);
    await edit(slugs.a);
    const w = await webhook("webhook", mode, slugs.a);
    const g = [];
    for (const i of [1, 2, 3]) g.push(await get(`get${i}`, `/blog/${slugs.a}`));
    summary.push(
      `${build} s2 ${mode}: webhook ${w.status} in ${w.ms} ms, origin hits during webhook ${w.delta}; gets: ${g.map((r) => `${r.title}/${r.cache}/${r.ms}ms/+${r.delta}`).join(", ")}`,
    );
  }
}

async function s3() {
  await fresh("s3-hygiene");
  await warm(slugs.a);
  await edit(slugs.a);
  const bad = await webhook("bad-secret", "tag-expire0", slugs.a, { secret: "wrong-secret-value-00" });
  const g1 = await get("get1", `/blog/${slugs.a}`);
  const w1 = await webhook("valid-1", "tag-expire0", slugs.a);
  const w2 = await webhook("valid-2", "tag-expire0", slugs.a);
  const g2 = await get("get2", `/blog/${slugs.a}`);
  const g3 = await get("get3", `/blog/${slugs.a}`);
  summary.push(
    `${build} s3 hygiene: wrong secret ${bad.status}, next get ${g1.title}; duplicate webhooks ${w1.status}/${w2.status}; gets after: ${g2.title}/+${g2.delta}, ${g3.title}/+${g3.delta}`,
  );
}

async function s4() {
  await fresh("s4-unpublish");
  await warm(slugs.a);
  await control(`/__unpublish?id=${seed.posts.find((p) => p.slug === slugs.a).id}`);
  await webhook("webhook", "tag-expire0", slugs.a);
  const g1 = await get("get1", `/blog/${slugs.a}`);
  const g2 = await get("get2", `/blog/${slugs.a}`);
  summary.push(`${build} s4 unpublish + tag-expire0: get1 ${g1.status} ${g1.title}, get2 ${g2.status} ${g2.title}`);
}

async function s5() {
  await fresh("s5-uncached");
  const g1 = await get("get1", `/blog/${slugs.d}`);
  const g2 = await get("get2", `/blog/${slugs.d}`);
  summary.push(`${build} s5 never-cached slug: get1 ${g1.status} ${g1.cache} +${g1.delta}, get2 ${g2.status} ${g2.cache} +${g2.delta}`);
}

async function outage(state) {
  const label = `s6-${state}`;
  await fresh(label);
  await warm(slugs.b); // b becomes the stale page once 31 s pass
  await sleep(31000);
  await warm(slugs.c); // c is the cached page still inside its window
  const before = (await hits()).log.length;
  await control(`/__mode?state=${state}`);
  print(`${RUN} ${build} ${label} mode ${((Date.now() - t0) / 1000).toFixed(1)} origin ${state}`);
  const out = [];
  for (const ua of ["browser", "googlebot", "bingbot"]) {
    out.push([ua, "fresh", await get(`${ua}-fresh`, `/blog/${slugs.c}`, { ua })]);
    out.push([ua, "stale", await get(`${ua}-stale`, `/blog/${slugs.b}`, { ua })]);
    out.push([ua, "uncached", await get(`${ua}-uncached`, `/blog/${slugs.d}`, { ua })]);
  }
  const log = (await hits()).log.slice(before);
  const closed = log.filter((l) => l.includes(" closed ")).map((l) => Number(l.match(/after (\d+) ms/)[1]));
  const opened = log.filter((l) => l.endsWith(" hang")).length;
  if (state === "hang") print(`${RUN} ${build} ${label} origin: ${opened} hung requests, ${closed.length} closed by the client before recovery, after ${closed.join(",") || "-"} ms`);
  await control("/__mode?state=up");
  await sleep(500);
  const rec = [];
  for (const [i, s] of [[1, slugs.b], [2, slugs.b], [3, slugs.d]]) rec.push(await get(`recover${i}`, `/blog/${s}`));
  summary.push(
    `${build} ${label}: ` +
      out.map(([ua, kind, r]) => `${ua} ${kind} ${r.status}/${r.title}/${r.ms}ms`).join("; ") +
      `; after recovery: ${rec.map((r) => `${r.status}/${r.title}`).join(", ")}`,
  );
}

async function s9() {
  const ports = [3001, 3002];
  for (const [i, port] of ports.entries()) await fresh("s9-two", {}, { dir: appDir(build, `-i${i + 1}`), port, resetOrigin: i === 0 });
  let warmed;
  for (const port of ports) warmed = (await warm(slugs.a, port), Date.now());
  await edit(slugs.a);
  await webhook("webhook", "tag-expire0", slugs.a, { port: 3001 });
  const g1 = await get("i1-get1", `/blog/${slugs.a}`, { port: 3001, note: "port=3001" });
  const g1b = await get("i1-get2", `/blog/${slugs.a}`, { port: 3001, note: "port=3001" });
  const g2 = await get("i2-get", `/blog/${slugs.a}`, { port: 3002, note: "port=3002" });
  // Wait until the page on 3002 is past its 30 s window.
  await sleep(Math.max(0, warmed + 31000 - Date.now()));
  const g3 = await get("i2-after1", `/blog/${slugs.a}`, { port: 3002, note: "port=3002" });
  const g4 = await get("i2-after2", `/blog/${slugs.a}`, { port: 3002, note: "port=3002" });
  for (const port of ports) await stopServer(port);
  summary.push(`${build} s9 two instances, webhook to 3001 only: 3001 ${g1.title} then ${g1b.title}, 3002 ${g2.title}; 3002 after its window: ${g3.title}/${g3.cache}, then ${g4.title}/${g4.cache}`);
}

async function s11() {
  const enter = `/api/draft?secret=${PREVIEW}&slug=/blog/${slugs.a}`;
  for (const withCredential of [true, false]) {
    const label = withCredential ? "s11-draft" : "s11-draft-nocred";
    await fresh(label, withCredential ? {} : { WP_APP_PASSWORD: "" });
    await control(`/__draft?id=${seed.posts.find((p) => p.slug === slugs.a).id}&title=${encodeURIComponent(DRAFT_TITLE)}`);
    await get("no-cookie", `/blog/${slugs.a}`);
    if (withCredential) await get("bad-secret", `/api/draft?secret=wrong-preview-secret&slug=/blog/${slugs.a}`);
    const before = (await hits()).hits;
    const start = Date.now();
    const res = await fetch(`http://127.0.0.1:3000${enter}`, { redirect: "manual", headers: { "user-agent": UA.browser } });
    const cookie = res.headers.getSetCookie().map((c) => c.split(";")[0]).join("; ");
    row("enable", "browser", "/api/draft?secret=ok", res.status, "-", "-", "-", await delta(before), Date.now() - start, `location=${res.headers.get("location")} set-cookie=${cookie.split("=")[0] || "-"}`);
    const logStart = (await hits()).log.length;
    const d = await get("with-cookie", `/blog/${slugs.a}`, { cookie });
    const auth = (await hits()).log.slice(logStart).map((l) => l.match(/auth=(\w+)/)?.[1]).join(",");
    print(`${RUN} ${build} ${label} origin-auth ${auth || "-"}`);
    const v = await get("visitor", `/blog/${slugs.a}`);
    const off = await fetch("http://127.0.0.1:3000/api/draft/disable", { method: "POST", headers: { cookie } });
    const cleared = off.headers.getSetCookie()[0] ?? "-";
    row("disable", "browser", "/api/draft/disable", off.status, "-", "-", "-", 0, 0, `set-cookie=${cleared.split(";").slice(0, 2).join(";")}`);
    summary.push(`${build} ${label}: enable ${res.status}, with cookie ${d.title} (${d.cache}, origin auth ${auth || "-"}), visitor without cookie ${v.title}`);
  }
}

async function s12() {
  await fresh("s12-images");
  const img = async (step, url) => {
    const res = await fetch(`http://127.0.0.1:3000/_next/image?url=${encodeURIComponent(url)}&w=640&q=75`);
    const body = Buffer.from(await res.arrayBuffer());
    const type = res.headers.get("content-type") ?? "-";
    const first = body.length < 300 ? `body: ${body.toString().split("\n")[0]}` : `${body.length} bytes ${type}`;
    print(`${RUN} ${build} s12-images ${step} ${res.status} cache-control=${res.headers.get("cache-control") ?? "-"} | ${first}`);
    return res.status;
  };
  const local = await img("local-ip", "http://127.0.0.1:4010/wp-content/uploads/test.jpg");
  const wporg = await img("wordpress.org", seed.image);
  const other = await img("unlisted-host", seed.image.replace("https://wordpress.org/", "https://i0.wp.com/wordpress.org/"));
  const slash = await get("trailing-slash", `/blog/${slugs.a}/`);
  const chains = [];
  for (const [i, r] of seed.redirects.slice(0, 2).entries()) {
    // Request the old permalink the way WordPress printed it, with a trailing slash.
    let p = r.from.endsWith("/") ? r.from : r.from + "/";
    const chain = [];
    for (let hop = 0; hop < 4 && p; hop++) {
      const res = await fetch(`http://127.0.0.1:3000${p}`, { redirect: "manual" });
      await res.text();
      chain.push(`${res.status} ${p}`);
      p = res.status >= 300 && res.status < 400 ? res.headers.get("location") : null;
    }
    print(`${RUN} ${build} s12-images old-permalink-row${i + 1} source=${r.from} | ${chain.join(" then ")}`);
    chains.push(`row ${i + 1} (${r.from.endsWith("/") ? "source with slash" : "source without slash"}): ${chain.join(" then ")}`);
  }
  summary.push(`${build} s12: image local-ip ${local}, wordpress.org ${wporg}, unlisted host ${other}; /blog/<slug>/ ${slash.status} ${slash.note}; ${chains.join("; ")}`);
}

async function s6expired(started) {
  // A server that kept running: its page was generated at `started`; wait past expire (300 s).
  const wait = started + 305000 - Date.now();
  if (wait > 0) await sleep(wait);
  scenario = "s6-expired";
  t0 = started;
  await control("/__mode?state=hang");
  const g1 = await get("browser", `/blog/${slugs.a}`, { port: 3005, note: "port=3005" });
  const g2 = await get("bingbot", `/blog/${slugs.a}`, { ua: "bingbot", port: 3005, note: "port=3005" });
  await control("/__mode?state=up");
  await stopServer(3005);
  summary.push(`${build} s6-expired (page generated ${g1.t_s} s earlier, origin hanging): browser ${g1.status}/${g1.title}/${g1.ms}ms, bingbot ${g2.status}/${g2.title}/${g2.ms}ms`);
}

async function s10() {
  await stopServer(3000);
  await control("/__reset");
  await control("/__mode?state=refuse");
  const age = Math.round((Date.now() - builtAt[build]) / 1000);
  await fresh("s10-restart", {}, { resetOrigin: false });
  const g = [];
  for (const ua of ["browser", "googlebot", "bingbot"]) g.push(await get(`restart-${ua}`, `/blog/${slugs.a}`, { ua, note: `page_age_s=${age}` }));
  const u = await get("restart-uncached", `/blog/${slugs.d}`);
  await stopServer(3000);
  const dir = appDir(build, "-down");
  // A clean checkout: no .next, so no fetch cache left over from the first build.
  fs.rmSync(path.join(dir, ".next"), { recursive: true, force: true });
  fs.rmSync(path.join(dir, ".next-pristine"), { recursive: true, force: true });
  const start = Date.now();
  let code = 0;
  let out = "";
  try {
    out = execFileSync(path.join(dir, "node_modules/.bin/next"), ["build"], { cwd: dir, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], env: { ...process.env, NODE_OPTIONS: NODE_FLAG } });
  } catch (e) {
    code = e.status;
    out = `${e.stdout}\n${e.stderr}`;
  }
  fs.writeFileSync(path.join(OUT, `build-${build}-origin-down.log`), out);
  const lines = out.split("\n");
  const firstError = [lines.find((l) => /error/i.test(l)), lines.find((l) => l.startsWith("Error occurred"))].filter(Boolean).map((l) => l.trim()).join(" | ") || "-";
  print(`${RUN} ${build} s10-restart next-build-origin-refused exit=${code} in ${Date.now() - start} ms | ${firstError}`);
  await control("/__mode?state=up");
  summary.push(`${build} s10 restart with origin refused (page age ${age} s): ${g.map((r) => `${r.ua} ${r.status}/${r.title}`).join(", ")}, uncached ${u.status}/${u.title}; next build exit ${code}`);
}

// ---------- REST vs WPGraphQL on demo.wpgraphql.com ----------
async function s8() {
  build = "-";
  scenario = "s8-api";
  const base = "https://demo.wpgraphql.com";
  const keep = ["cache-control", "x-cache", "x-cacheable", "cf-cache-status", "age"];
  const call = async (label, url, init = {}) => {
    const start = Date.now();
    const res = await fetch(url, init);
    const text = await res.text();
    const ms = Date.now() - start;
    const h = keep.map((k) => `${k}=${res.headers.get(k) ?? "-"}`).join(" ");
    print(`${RUN} - s8-api ${label} ${res.status} ${Buffer.byteLength(text)} bytes ${ms} ms | ${h}`);
    return { bytes: Buffer.byteLength(text), ms, json: JSON.parse(text) };
  };
  const [{ slug }] = await (await fetch(`${base}/wp-json/wp/v2/posts?per_page=1&_fields=slug`)).json();
  print(`${RUN} - s8-api post slug=${slug}`);
  const r1 = await call("rest-post", `${base}/wp-json/wp/v2/posts?slug=${slug}`);
  const post = r1.json[0];
  const r2 = await call("rest-author", `${base}/wp-json/wp/v2/users/${post.author}`);
  const r3 = await call("rest-categories", `${base}/wp-json/wp/v2/categories?include=${post.categories.join(",")}`);
  const e1 = await call("rest-embed", `${base}/wp-json/wp/v2/posts?slug=${slug}&_embed=author,wp:term`);
  const e2 = await call("rest-embed-fields", `${base}/wp-json/wp/v2/posts?slug=${slug}&_embed=author,wp:term&_fields=title,content,_links,_embedded`);
  const query = `{post(id:"${slug}",idType:SLUG){title content author{node{name}} categories{nodes{name}}}}`;
  const g1 = await call("graphql-get", `${base}/graphql?query=${encodeURIComponent(query)}`);
  const g2 = await call("graphql-post", `${base}/graphql`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ query }) });
  const restSame = [post.title.rendered, r2.json.name, r3.json.map((c) => c.name).sort().join("|")];
  const gp = g1.json.data.post;
  const gqlSame = [gp.title, gp.author.node.name, gp.categories.nodes.map((c) => c.name).sort().join("|")];
  print(`${RUN} - s8-api same title, author and categories both ways: ${JSON.stringify(restSame) === JSON.stringify(gqlSame) ? "yes" : "no"} ${JSON.stringify(gqlSame)}`);
  summary.push(
    `s8 REST: 3 requests ${r1.bytes + r2.bytes + r3.bytes} bytes; REST _embed: 1 request ${e1.bytes} bytes; REST _embed+_fields: 1 request ${e2.bytes} bytes; WPGraphQL GET: 1 request ${g1.bytes} bytes; WPGraphQL POST: 1 request ${g2.bytes} bytes`,
  );
}

// ---------- setup ----------
const builtAt = {};
function assemble(b) {
  const dir = appDir(b);
  for (const src of ["shared", `variant-${b.toLowerCase()}`]) execFileSync("cp", ["-R", `${path.join(H, src)}/`, `${dir}/`]);
  fs.writeFileSync(path.join(dir, "redirects.json"), JSON.stringify(seed.redirects, null, 2) + "\n");
}
function nextBuild(b) {
  const dir = appDir(b);
  fs.rmSync(path.join(dir, ".next"), { recursive: true, force: true });
  fs.rmSync(path.join(dir, ".next-pristine"), { recursive: true, force: true });
  const start = Date.now();
  const out = execFileSync(path.join(dir, "node_modules/.bin/next"), ["build"], { cwd: dir, encoding: "utf8", env: { ...process.env, NODE_OPTIONS: NODE_FLAG } });
  fs.writeFileSync(path.join(OUT, `build-${b}.log`), out);
  builtAt[b] = Date.now();
  print(`${RUN} ${b} build exit=0 in ${Date.now() - start} ms`);
  const table = out.split("\n");
  const i = table.findIndex((l) => l.startsWith("Route (app)"));
  for (const l of table.slice(i, table.indexOf("", i))) print(`${RUN} ${b} | ${l}`);
  execFileSync("cp", ["-Rc", path.join(dir, ".next"), path.join(dir, ".next-pristine")]);
  for (const suffix of ["-i1", "-i2", "-i3", "-down"]) {
    fs.rmSync(appDir(b, suffix), { recursive: true, force: true });
    execFileSync("cp", ["-Rc", dir, appDir(b, suffix)]);
  }
}

async function portsFree() {
  for (const port of [3000, 3001, 3002, 3005, 4010, 4011]) {
    const inUse = await new Promise((resolve) => {
      const probe = net.connect(port, "127.0.0.1", () => (probe.destroy(), resolve(true)));
      probe.on("error", () => resolve(false));
    });
    if (inUse) throw new Error(`port ${port} is already in use; stop that process first`);
  }
}

async function main() {
  await portsFree();
  const pkg = (p) => JSON.parse(fs.readFileSync(path.join(H, "app-a/node_modules", p, "package.json"), "utf8")).version;
  print(`run ${RUN} of 3, ${new Date().toISOString()}`);
  print(`node ${process.version} | next ${pkg("next")} | react ${pkg("react")} | ${os.type()} ${os.release()} (macOS ${execFileSync("sw_vers", ["-productVersion"], { encoding: "utf8" }).trim()}) | ${os.cpus()[0].model}, ${os.cpus().length} cores, ${Math.round(os.totalmem() / 2 ** 30)} GB | node flag ${NODE_FLAG}`);

  // Seed: one pull of 4 published posts from WordPress.org News over the WordPress REST API.
  const url = "https://wordpress.org/news/wp-json/wp/v2/posts?per_page=4&_embed=author,wp:featuredmedia,wp:term";
  const res = await fetch(url);
  const posts = await res.json();
  const d0 = posts[0].date_gmt;
  seed = {
    fetched_at: new Date().toISOString(),
    url,
    x_wp_total: res.headers.get("x-wp-total"),
    link: res.headers.get("link"),
    // An image from the WordPress.org News uploads folder, used in a recent post (none of the 4 has a featured image).
    image: "https://wordpress.org/news/files/2026/10/Forms-Global-1.webp",
    // A sample redirect list we wrote, the shape a WordPress redirect plugin export would map to. Not a real export.
    redirects: [
      { from: `/${d0.slice(0, 4)}/${d0.slice(5, 7)}/${posts[0].slug}/`, to: `/blog/${posts[0].slug}` },
      { from: `/${posts[1].date_gmt.slice(0, 4)}/${posts[1].date_gmt.slice(5, 7)}/${posts[1].slug}`, to: `/blog/${posts[1].slug}` },
      { from: "/category/releases/", to: "/blog" },
    ],
    posts,
  };
  fs.writeFileSync(path.join(OUT, "seed.json"), JSON.stringify(seed, null, 2));
  slugs = { a: posts[0].slug, b: posts[1].slug, c: posts[2].slug, d: posts[3].slug };
  print(`seed fetched ${seed.fetched_at} | x-wp-total ${seed.x_wp_total} | prerendered: ${posts.slice(0, 3).map((p) => `${p.id} ${p.slug}`).join(", ")} | never cached: ${posts[3].id} ${posts[3].slug}`);
  print("run build scenario step t_s ua path status x-nextjs-cache title_seen rendered_at origin_hits_delta ms note");

  const origin = await startProcess("node", [path.join(H, "origin.mjs"), path.join(OUT, "seed.json")], {}, path.join(OUT, "origin.log"), "origin up");
  try {
    for (const b of ["A", "B"]) {
      build = b;
      assemble(b);
      nextBuild(b);
      // Wait until the prerendered pages are older than their 30 s window.
      await sleep(Math.max(0, builtAt[b] + 31000 - Date.now()));
      // s6-expired: a second server that keeps running; its page is generated now.
      scenario = "s6-expired";
      await fresh("s6-expired", {}, { dir: appDir(b, "-i3"), port: 3005, resetOrigin: true });
      await warm(slugs.a, 3005);
      const started = Date.now();
      await s1();
      await s2();
      await s3();
      await s4();
      await s5();
      for (const state of ["hang", "refuse", "503"]) await outage(state);
      await s9();
      await s11();
      await s12();
      await stopServer(3000);
      await s6expired(started);
      await s10();
    }
    await s8();
  } finally {
    for (const port of [...servers.keys()]) await stopServer(port);
    origin.kill("SIGTERM");
  }
  print("summary");
  for (const s of summary) print(s);
  fs.writeFileSync(path.join(OUT, "results.json"), JSON.stringify({ seed: { fetched_at: seed.fetched_at, x_wp_total: seed.x_wp_total, slugs }, rows, summary }, null, 2));
}

main().catch((e) => {
  console.error(e);
  process.exit(1);
});

Shared by both builds, shared/lib/secret.ts:

import { timingSafeEqual } from "node:crypto";

// Constant-time comparison; the length check first, because timingSafeEqual throws on unequal lengths.
export function secretMatches(given: string | null, expected: string | undefined): boolean {
  if (!expected || given === null) return false;
  const a = Buffer.from(given);
  const b = Buffer.from(expected);
  return a.length === b.length && timingSafeEqual(a, b);
}

shared/app/layout.tsx:

export default function RootLayout({ children }: LayoutProps<"/">) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  );
}

shared/app/api/revalidate/route.ts is shown in full in the webhook section above, and shared/app/api/draft/route.ts in the Draft Mode section. shared/app/api/draft/disable/route.ts:

import { draftMode } from "next/headers";

export async function POST() {
  (await draftMode()).disable();
  return new Response("Draft mode is disabled");
}

shared/app/blog/page.tsx:

import Link from "next/link";
import { getPosts } from "@/lib/wp";

export default async function BlogIndex() {
  const posts = await getPosts();
  return (
    <ul>
      {posts.map((p) => (
        <li key={p.id}>
          <Link href={`/blog/${p.slug}`} dangerouslySetInnerHTML={{ __html: p.title.rendered }} />
        </li>
      ))}
    </ul>
  );
}

Build A, variant-a/lib/wp.ts:

// Build A: the previous caching model (cacheComponents: false), fetch with next.revalidate and tags.
import { draftMode } from "next/headers";

const WP = process.env.WP_URL ?? "http://127.0.0.1:4010";
const FIELDS = "_fields=id,slug,title,content,modified_gmt";
export type Post = { id: number; slug: string; title: { rendered: string }; content: { rendered: string }; modified_gmt: string };

async function wp<T>(path: string, init: RequestInit & { next?: { revalidate?: number; tags?: string[] } }): Promise<T> {
  // Every WordPress call gets a timeout, so a hung origin cannot hold a render forever.
  const res = await fetch(WP + path, { ...init, signal: AbortSignal.timeout(5000) });
  if (!res.ok) throw new Error(`WordPress returned ${res.status} for ${path}`);
  return res.json() as Promise<T>;
}

export async function getPost(slug: string): Promise<Post | null> {
  const { isEnabled } = await draftMode();
  const s = encodeURIComponent(slug);
  if (isEnabled && process.env.WP_APP_PASSWORD) {
    // Draft Mode skips the cache; the credential is what makes WordPress return the draft.
    const auth = "Basic " + Buffer.from(process.env.WP_APP_PASSWORD).toString("base64");
    const posts = await wp<Post[]>(`/wp-json/wp/v2/posts?slug=${s}&context=edit&${FIELDS}`, { headers: { authorization: auth } });
    return posts[0] ?? null;
  }
  const posts = await wp<Post[]>(`/wp-json/wp/v2/posts?slug=${s}&${FIELDS}`, {
    next: { revalidate: 30, tags: [`post-${slug}`] },
  });
  return posts[0] ?? null;
}

export async function getPosts(): Promise<Post[]> {
  return wp<Post[]>(`/wp-json/wp/v2/posts?per_page=3&${FIELDS}`, { next: { revalidate: 30, tags: ["posts"] } });
}

Build A, variant-a/app/blog/[slug]/page.tsx:

import { notFound } from "next/navigation";
import { getPost, getPosts } from "@/lib/wp";

export async function generateStaticParams() {
  return (await getPosts()).map((p) => ({ slug: p.slug }));
}

export default async function PostPage({ params }: PageProps<"/blog/[slug]">) {
  const { slug } = await params;
  const post = await getPost(slug);
  if (!post) notFound();
  return (
    <article data-rendered-at={new Date().toISOString()}>
      <h1 dangerouslySetInnerHTML={{ __html: post.title.rendered }} />
      <div dangerouslySetInnerHTML={{ __html: post.content.rendered }} />
    </article>
  );
}

Build A, variant-a/next.config.ts:

import type { NextConfig } from "next";
import redirectList from "./redirects.json";

const nextConfig: NextConfig = {
  cacheComponents: false,
  images: {
    remotePatterns: [
      { protocol: "https", hostname: "wordpress.org", pathname: "/news/files/**" },
      // Listed on purpose, to see whether a local IP is still refused (dangerouslyAllowLocalIP defaults to false).
      { protocol: "http", hostname: "127.0.0.1", port: "4010", pathname: "/wp-content/uploads/**" },
    ],
  },
  // A sample list we wrote for the test, in the shape a WordPress redirect plugin export would map to.
  async redirects() {
    return redirectList.map((r) => ({ source: r.from, destination: r.to, permanent: true }));
  },
};

export default nextConfig;

Build B uses stale: 30 and expire: 300 because the cacheLife reference says a stale "under 30 seconds" and an "expire under 5 minutes" are "excluded from prerenders". Its post page wraps the post in <Suspense>, because the caching docs say components that read runtime APIs such as params "should be wrapped in <Suspense>".

Build B, variant-b/lib/wp.ts:

// Build B: Cache Components (the create-next-app default), 'use cache' with cacheLife and cacheTag.
import { cacheLife, cacheTag } from "next/cache";
import { draftMode } from "next/headers";

const WP = process.env.WP_URL ?? "http://127.0.0.1:4010";
const FIELDS = "_fields=id,slug,title,content,modified_gmt";
export type Post = { id: number; slug: string; title: { rendered: string }; content: { rendered: string }; modified_gmt: string };

async function wp<T>(path: string, init: RequestInit = {}): Promise<T> {
  // Every WordPress call gets a timeout, so a hung origin cannot hold a render forever.
  const res = await fetch(WP + path, { ...init, signal: AbortSignal.timeout(5000) });
  if (!res.ok) throw new Error(`WordPress returned ${res.status} for ${path}`);
  return res.json() as Promise<T>;
}

export async function getPost(slug: string): Promise<(Post & { fetchedAt: string }) | null> {
  "use cache";
  // stale under 30 s would keep this out of the prerender, so stale is 30, not 0.
  cacheLife({ stale: 30, revalidate: 30, expire: 300 });
  cacheTag(`post-${slug}`);
  const { isEnabled } = await draftMode();
  const s = encodeURIComponent(slug);
  let posts: Post[];
  if (isEnabled && process.env.WP_APP_PASSWORD) {
    // Draft Mode re-runs this function on every request; the credential is what returns the draft.
    const auth = "Basic " + Buffer.from(process.env.WP_APP_PASSWORD).toString("base64");
    posts = await wp<Post[]>(`/wp-json/wp/v2/posts?slug=${s}&context=edit&${FIELDS}`, { headers: { authorization: auth } });
  } else {
    posts = await wp<Post[]>(`/wp-json/wp/v2/posts?slug=${s}&${FIELDS}`);
  }
  return posts[0] ? { ...posts[0], fetchedAt: new Date().toISOString() } : null;
}

export async function getPosts(): Promise<Post[]> {
  "use cache";
  cacheLife({ stale: 30, revalidate: 30, expire: 300 });
  cacheTag("posts");
  return wp<Post[]>(`/wp-json/wp/v2/posts?per_page=3&${FIELDS}`);
}

Build B, variant-b/app/blog/[slug]/page.tsx:

import { Suspense } from "react";
import { notFound } from "next/navigation";
import { getPost, getPosts } from "@/lib/wp";

export async function generateStaticParams() {
  return (await getPosts()).map((p) => ({ slug: p.slug }));
}

export default function PostPage({ params }: PageProps<"/blog/[slug]">) {
  return (
    <Suspense fallback={<p>Loading post</p>}>
      <PostBody params={params} />
    </Suspense>
  );
}

async function PostBody({ params }: { params: PageProps<"/blog/[slug]">["params"] }) {
  const { slug } = await params;
  const post = await getPost(slug);
  if (!post) notFound();
  return (
    <article data-rendered-at={post.fetchedAt}>
      <h1 dangerouslySetInnerHTML={{ __html: post.title.rendered }} />
      <div dangerouslySetInnerHTML={{ __html: post.content.rendered }} />
    </article>
  );
}

Build B, variant-b/next.config.ts:

import type { NextConfig } from "next";
import redirectList from "./redirects.json";

const nextConfig: NextConfig = {
  cacheComponents: true,
  partialPrefetching: true,
  images: {
    remotePatterns: [
      { protocol: "https", hostname: "wordpress.org", pathname: "/news/files/**" },
      // Listed on purpose, to see whether a local IP is still refused (dangerouslyAllowLocalIP defaults to false).
      { protocol: "http", hostname: "127.0.0.1", port: "4010", pathname: "/wp-content/uploads/**" },
    ],
  },
  // A sample list we wrote for the test, in the shape a WordPress redirect plugin export would map to.
  async redirects() {
    return redirectList.map((r) => ({ source: r.from, destination: r.to, permanent: true }));
  },
};

export default nextConfig;

The WordPress mu-plugin, nextjs-revalidate.php, is shown in full in the webhook section. It passed php -l on PHP 8.5.12 (the WebAssembly build from @php-wasm/cli), and we did not run it against WordPress.

Traced example: one expire 0 webhook with Cache Components on

These rows are from run 1's output for Build B's s2-tag-expire0 pass:

1 B s2-tag-expire0 warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:16:01.695 0 6
1 B s2-tag-expire0 webhook 1.7 webhook /api/revalidate:tag-expire0 200 - - - 0 16
1 B s2-tag-expire0 get1 1.9 browser /blog/wordpress-7-2-beta-4 200 - old 10:14:16.175 1 33 cache-control=private postponed
1 B s2-tag-expire0 get2 2.1 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:16:03.200 0 5

Columns: run, build, scenario, step, seconds, user agent, path, status, x-nextjs-cache, title, data-rendered-at (UTC), replay requests, milliseconds, notes. The webhook returned 200 in 16 ms and the replay received nothing. The first request after it carried the render time of next build, nearly two minutes earlier, came back private and postponed, and cost one replay request. The request after that got the new title.

The unedited output of node run.mjs 1 from 2026-11-09 (run 1 of 3):

run 1 of 3, 2026-11-09T10:08:19.818Z
node v24.20.0 | next 16.4.5 | react 19.3.0 | Darwin 27.0.0 (macOS 27.0.1) | Apple M1 Max, 10 cores, 64 GB | node flag --network-family-autoselection-attempt-timeout=1000
seed fetched 2026-11-09T10:08:21.034Z | x-wp-total 1115 | prerendered: 21907 wordpress-7-2-beta-4, 21896 wordpress-7-1-4, 21890 wordpress-7-2-beta-2 | never cached: 21835 critical-php-security-release
run build scenario step t_s ua path status x-nextjs-cache title_seen rendered_at origin_hits_delta ms note
1 A build exit=0 in 3473 ms
1 A | Route (app)                       Revalidate  Expire
1 A | ┌ ○ /_not-found
1 A | ├ ƒ /api/draft
1 A | ├ ƒ /api/draft/disable
1 A | ├ ƒ /api/revalidate
1 A | ├ ○ /blog                                30s      1y
1 A | └   /blog/[slug]
1 A |   ├ ● /blog/wordpress-7-2-beta-4         30s      1y
1 A |   ├ ● /blog/wordpress-7-1-4              30s      1y
1 A |   └ ● /blog/wordpress-7-2-beta-2         30s      1y
1 A s6-expired warm1 1.8 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 1654
1 A s6-expired warm2 3.0 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:08:59.316 0 10
1 A s1-window warm1 0.4 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 221
1 A s1-window warm2 1.6 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:09:01.181 0 20
1 A s1-window t0 0.2 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:09:01.181 0 11
1 A s1-window t5 5.2 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:09:01.181 0 3
1 A s1-window edit 10.0 origin title changed
1 A s1-window t25 25.2 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:09:01.181 0 11
1 A s1-window t31 31.2 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:09:01.181 1 17
1 A s1-window t32 32.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:09:33.520 0 7
1 A s1-window t35 35.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:09:33.520 0 12
1 A s1-window t62 62.2 browser /blog/wordpress-7-2-beta-4 200 STALE new 10:09:33.520 1 5
1 A s2-path warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 139
1 A s2-path warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:10:05.040 0 5
1 A s2-path webhook 1.6 webhook /api/revalidate:path 200 - - - 0 31
1 A s2-path get1 1.8 browser /blog/wordpress-7-2-beta-4 200 MISS new 10:10:06.548 1 16
1 A s2-path get2 2.0 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:10:06.548 0 7
1 A s2-path get3 2.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:10:06.548 0 6
1 A s2-tag-max warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 143
1 A s2-tag-max warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:10:07.454 0 30
1 A s2-tag-max webhook 1.7 webhook /api/revalidate:tag-max 200 - - - 0 40
1 A s2-tag-max get1 1.9 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:10:07.454 1 41
1 A s2-tag-max get2 2.1 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:10:09.039 0 6
1 A s2-tag-max get3 2.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:10:09.039 0 11
1 A s2-tag-expire0 warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 155
1 A s2-tag-expire0 warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:10:09.964 0 9
1 A s2-tag-expire0 webhook 1.7 webhook /api/revalidate:tag-expire0 200 - - - 0 46
1 A s2-tag-expire0 get1 1.9 browser /blog/wordpress-7-2-beta-4 200 MISS new 10:10:11.522 1 26
1 A s2-tag-expire0 get2 2.1 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:10:11.522 0 6
1 A s2-tag-expire0 get3 2.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:10:11.522 0 18
1 A s2-tag-single warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 142
1 A s2-tag-single warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:10:12.456 0 10
1 A s2-tag-single webhook 1.7 webhook /api/revalidate:tag-single 200 - - - 0 37
1 A s2-tag-single get1 1.9 browser /blog/wordpress-7-2-beta-4 200 MISS new 10:10:13.996 1 20
1 A s2-tag-single get2 2.0 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:10:13.996 0 6
1 A s2-tag-single get3 2.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:10:13.996 0 13
1 A s3-hygiene warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 141
1 A s3-hygiene warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:10:14.890 0 22
1 A s3-hygiene bad-secret 1.7 webhook /api/revalidate:tag-expire0 401 - - - 0 46
1 A s3-hygiene get1 1.9 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:10:14.890 0 8
1 A s3-hygiene valid-1 2.1 webhook /api/revalidate:tag-expire0 200 - - - 0 21
1 A s3-hygiene valid-2 2.2 webhook /api/revalidate:tag-expire0 200 - - - 0 17
1 A s3-hygiene get2 2.4 browser /blog/wordpress-7-2-beta-4 200 MISS new 10:10:17.009 1 39
1 A s3-hygiene get3 2.6 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:10:17.009 0 6
1 A s4-unpublish warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 142
1 A s4-unpublish warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:10:17.756 0 24
1 A s4-unpublish webhook 1.7 webhook /api/revalidate:tag-expire0 200 - - - 0 28
1 A s4-unpublish get1 1.9 browser /blog/wordpress-7-2-beta-4 404 MISS none - 1 38
1 A s4-unpublish get2 2.0 browser /blog/wordpress-7-2-beta-4 404 HIT none - 0 8
1 A s5-uncached get1 0.3 browser /blog/critical-php-security-release 200 MISS old 10:10:20.098 1 177
1 A s5-uncached get2 0.5 browser /blog/critical-php-security-release 200 HIT old 10:10:20.098 0 9
1 A s6-hang warm1 0.3 browser /blog/wordpress-7-1-4 200 STALE old 10:08:24.031 1 142
1 A s6-hang warm2 1.5 browser /blog/wordpress-7-1-4 200 HIT old 10:10:20.848 0 23
1 A s6-hang warm1 32.7 browser /blog/wordpress-7-2-beta-2 200 STALE old 10:08:24.031 1 28
1 A s6-hang warm2 33.9 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:10:53.223 0 18
1 A s6-hang mode 33.9 origin hang
1 A s6-hang browser-fresh 34.1 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:10:53.223 0 12
1 A s6-hang browser-stale 34.3 browser /blog/wordpress-7-1-4 200 STALE old 10:10:20.848 1 30
1 A s6-hang browser-uncached 39.5 browser /blog/critical-php-security-release 500 - none - 1 5047 cache-control=private
1 A s6-hang googlebot-fresh 39.6 googlebot /blog/wordpress-7-2-beta-2 200 HIT old 10:10:53.223 0 4
1 A s6-hang googlebot-stale 39.8 googlebot /blog/wordpress-7-1-4 200 STALE old 10:10:20.848 0 5
1 A s6-hang googlebot-uncached 45.0 googlebot /blog/critical-php-security-release 500 - none - 1 5052 cache-control=private
1 A s6-hang bingbot-fresh 45.2 bingbot /blog/wordpress-7-2-beta-2 200 HIT old 10:10:53.223 0 17
1 A s6-hang bingbot-stale 45.3 bingbot /blog/wordpress-7-1-4 200 STALE old 10:10:20.848 0 5
1 A s6-hang bingbot-uncached 50.5 bingbot /blog/critical-php-security-release 500 - none - 1 5033 cache-control=private
1 A s6-hang origin: 4 hung requests, 3 closed by the client before recovery, after 5003,5004,5003 ms
1 A s6-hang recover1 51.2 browser /blog/wordpress-7-1-4 200 HIT old 10:10:20.848 0 19
1 A s6-hang recover2 51.4 browser /blog/wordpress-7-1-4 200 HIT old 10:10:20.848 0 15
1 A s6-hang recover3 51.6 browser /blog/critical-php-security-release 200 MISS old 10:11:12.100 1 23
1 A s6-refuse warm1 0.3 browser /blog/wordpress-7-1-4 200 STALE old 10:08:24.031 1 142
1 A s6-refuse warm2 1.5 browser /blog/wordpress-7-1-4 200 HIT old 10:11:12.682 0 5
1 A s6-refuse warm1 32.7 browser /blog/wordpress-7-2-beta-2 200 STALE old 10:08:24.031 1 22
1 A s6-refuse warm2 33.8 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:11:45.038 0 17
1 A s6-refuse mode 33.9 origin refuse
1 A s6-refuse browser-fresh 34.0 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:11:45.038 0 8
1 A s6-refuse browser-stale 34.2 browser /blog/wordpress-7-1-4 200 STALE old 10:11:12.682 0 26
1 A s6-refuse browser-uncached 34.4 browser /blog/critical-php-security-release 500 - none - 0 19 cache-control=private
1 A s6-refuse googlebot-fresh 34.6 googlebot /blog/wordpress-7-2-beta-2 200 HIT old 10:11:45.038 0 16
1 A s6-refuse googlebot-stale 34.7 googlebot /blog/wordpress-7-1-4 200 HIT old 10:11:12.682 0 4
1 A s6-refuse googlebot-uncached 34.9 googlebot /blog/critical-php-security-release 500 - none - 0 25 cache-control=private
1 A s6-refuse bingbot-fresh 35.1 bingbot /blog/wordpress-7-2-beta-2 200 HIT old 10:11:45.038 0 13
1 A s6-refuse bingbot-stale 35.3 bingbot /blog/wordpress-7-1-4 200 HIT old 10:11:12.682 0 17
1 A s6-refuse bingbot-uncached 35.4 bingbot /blog/critical-php-security-release 500 - none - 0 17 cache-control=private
1 A s6-refuse recover1 36.1 browser /blog/wordpress-7-1-4 200 HIT old 10:11:12.682 0 18
1 A s6-refuse recover2 36.3 browser /blog/wordpress-7-1-4 200 HIT old 10:11:12.682 0 27
1 A s6-refuse recover3 36.5 browser /blog/critical-php-security-release 200 MISS old 10:11:48.855 1 11
1 A s6-503 warm1 0.3 browser /blog/wordpress-7-1-4 200 STALE old 10:08:24.031 1 148
1 A s6-503 warm2 1.5 browser /blog/wordpress-7-1-4 200 HIT old 10:11:49.431 0 20
1 A s6-503 warm1 32.7 browser /blog/wordpress-7-2-beta-2 200 STALE old 10:08:24.031 1 17
1 A s6-503 warm2 33.8 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:12:21.780 0 6
1 A s6-503 mode 33.8 origin 503
1 A s6-503 browser-fresh 34.0 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:12:21.780 0 3
1 A s6-503 browser-stale 34.2 browser /blog/wordpress-7-1-4 200 STALE old 10:11:49.431 1 11
1 A s6-503 browser-uncached 34.3 browser /blog/critical-php-security-release 500 - none - 1 16 cache-control=private
1 A s6-503 googlebot-fresh 34.5 googlebot /blog/wordpress-7-2-beta-2 200 HIT old 10:12:21.780 0 28
1 A s6-503 googlebot-stale 34.7 googlebot /blog/wordpress-7-1-4 200 HIT old 10:11:49.431 0 4
1 A s6-503 googlebot-uncached 34.8 googlebot /blog/critical-php-security-release 500 - none - 1 18 cache-control=private
1 A s6-503 bingbot-fresh 35.0 bingbot /blog/wordpress-7-2-beta-2 200 HIT old 10:12:21.780 0 6
1 A s6-503 bingbot-stale 35.2 bingbot /blog/wordpress-7-1-4 200 HIT old 10:11:49.431 0 8
1 A s6-503 bingbot-uncached 35.4 bingbot /blog/critical-php-security-release 500 - none - 1 21 cache-control=private
1 A s6-503 recover1 36.1 browser /blog/wordpress-7-1-4 200 HIT old 10:11:49.431 0 16
1 A s6-503 recover2 36.2 browser /blog/wordpress-7-1-4 200 HIT old 10:11:49.431 0 6
1 A s6-503 recover3 36.4 browser /blog/critical-php-security-release 200 MISS old 10:12:25.518 1 22
1 A s9-two warm1 1.0 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 879
1 A s9-two warm2 2.2 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:12:28.484 0 5
1 A s9-two warm1 2.4 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 40
1 A s9-two warm2 3.6 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:12:29.839 0 23
1 A s9-two webhook 3.8 webhook /api/revalidate:tag-expire0 200 - - - 0 35 port=3001
1 A s9-two i1-get1 4.0 browser /blog/wordpress-7-2-beta-4 200 MISS new 10:12:31.384 1 26 port=3001
1 A s9-two i1-get2 4.1 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:12:31.384 0 4 port=3001
1 A s9-two i2-get 4.3 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:12:29.839 0 6 port=3002
1 A s9-two i2-after1 34.8 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:12:29.839 1 25 port=3002
1 A s9-two i2-after2 34.9 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:13:02.217 0 7 port=3002
1 A s11-draft no-cookie 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 139
1 A s11-draft bad-secret 0.5 browser /api/draft?secret=wrong-preview-secret&slug=/blog/wordpress-7-2-beta-4 401 - none - 0 16
1 A s11-draft enable 0.6 browser /api/draft?secret=ok 307 - - - 0 168 location=/blog/wordpress-7-2-beta-4 set-cookie=__prerender_bypass
1 A s11-draft with-cookie 0.8 browser /blog/wordpress-7-2-beta-4 200 HIT draft 10:13:03.444 1 12 cache-control=private
1 A s11-draft origin-auth yes
1 A s11-draft visitor 1.0 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:13:02.945 0 11
1 A s11-draft disable 1.0 browser /api/draft/disable 200 - - - 0 0 set-cookie=__prerender_bypass=; Path=/
1 A s11-draft-nocred no-cookie 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 1 149
1 A s11-draft-nocred enable 0.5 browser /api/draft?secret=ok 307 - - - 0 165 location=/blog/wordpress-7-2-beta-4 set-cookie=__prerender_bypass
1 A s11-draft-nocred with-cookie 0.6 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:13:04.508 1 11 cache-control=private
1 A s11-draft-nocred origin-auth no
1 A s11-draft-nocred visitor 0.8 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:13:04.188 0 4
1 A s11-draft-nocred disable 0.8 browser /api/draft/disable 200 - - - 0 0 set-cookie=__prerender_bypass=; Path=/
1 A s12-images local-ip 400 cache-control=- | body: "url" parameter is not allowed
1 A s12-images wordpress.org 200 cache-control=public, max-age=315360000, must-revalidate | 10806 bytes image/jpeg
1 A s12-images unlisted-host 400 cache-control=- | body: "url" parameter is not allowed
1 A s12-images trailing-slash 3.6 browser /blog/wordpress-7-2-beta-4/ 308 - none - 0 2 location=/blog/wordpress-7-2-beta-4
1 A s12-images old-permalink-row1 source=/2026/11/wordpress-7-2-beta-4/ | 308 /2026/11/wordpress-7-2-beta-4/ then 404 /2026/11/wordpress-7-2-beta-4
1 A s12-images old-permalink-row2 source=/2026/10/wordpress-7-1-4 | 308 /2026/10/wordpress-7-1-4/ then 308 /2026/10/wordpress-7-1-4 then 200 /blog/wordpress-7-1-4
1 A s6-expired browser 305.2 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:59.316 1 8 port=3005
1 A s6-expired bingbot 305.3 bingbot /blog/wordpress-7-2-beta-4 200 STALE old 10:08:59.316 0 4 port=3005
1 A s10-restart restart-browser 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:08:24.029 0 137 page_age_s=341
1 A s10-restart restart-googlebot 0.5 googlebot /blog/wordpress-7-2-beta-4 200 HIT old 10:08:24.029 0 8 page_age_s=341
1 A s10-restart restart-bingbot 0.6 bingbot /blog/wordpress-7-2-beta-4 200 HIT old 10:08:24.029 0 4 page_age_s=341
1 A s10-restart restart-uncached 0.8 browser /blog/critical-php-security-release 500 - none - 0 22 cache-control=private
1 A s10-restart next-build-origin-refused exit=1 in 5662 ms | [TypeError: fetch failed] {
1 B build exit=0 in 4120 ms
1 B | Route (app)                       Revalidate  Expire
1 B | ┌ ○ /_not-found
1 B | ├ ƒ /api/draft
1 B | ├ ƒ /api/draft/disable
1 B | ├ ƒ /api/revalidate
1 B | ├ ○ /blog                                30s      5m
1 B | └   /blog/[slug]
1 B |   ├ ◐ /blog/[slug]
1 B |   ├ ○ /blog/wordpress-7-2-beta-4         30s      5m
1 B |   ├ ○ /blog/wordpress-7-1-4              30s      5m
1 B |   └ ○ /blog/wordpress-7-2-beta-2         30s      5m
1 B s6-expired warm1 2.4 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 2218
1 B s6-expired warm2 3.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:14:51.061 0 10
1 B s1-window warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 193
1 B s1-window warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:14:52.854 0 11
1 B s1-window t0 0.2 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:14:52.854 0 10
1 B s1-window t5 5.2 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:14:52.854 0 14
1 B s1-window edit 10.0 origin title changed
1 B s1-window t25 25.2 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:14:52.854 0 25
1 B s1-window t31 31.2 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:52.854 1 21
1 B s1-window t32 32.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:15:25.208 0 9
1 B s1-window t35 35.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:15:25.208 0 6
1 B s1-window t62 62.2 browser /blog/wordpress-7-2-beta-4 200 STALE new 10:15:25.208 1 12
1 B s2-path warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 161
1 B s2-path warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:15:56.777 0 8
1 B s2-path webhook 1.7 webhook /api/revalidate:path 200 - - - 0 16
1 B s2-path get1 1.8 browser /blog/wordpress-7-2-beta-4 200 - old 10:14:16.175 1 27 cache-control=private postponed
1 B s2-path get2 2.0 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:15:58.282 0 5
1 B s2-path get3 2.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:15:58.282 0 7
1 B s2-tag-max warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 174
1 B s2-tag-max warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:15:59.209 0 6
1 B s2-tag-max webhook 1.7 webhook /api/revalidate:tag-max 200 - - - 0 32
1 B s2-tag-max get1 1.9 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:15:59.209 1 16
1 B s2-tag-max get2 2.0 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:16:00.732 0 13
1 B s2-tag-max get3 2.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:16:00.732 0 10
1 B s2-tag-expire0 warm1 0.4 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 213
1 B s2-tag-expire0 warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:16:01.695 0 6
1 B s2-tag-expire0 webhook 1.7 webhook /api/revalidate:tag-expire0 200 - - - 0 16
1 B s2-tag-expire0 get1 1.9 browser /blog/wordpress-7-2-beta-4 200 - old 10:14:16.175 1 33 cache-control=private postponed
1 B s2-tag-expire0 get2 2.1 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:16:03.200 0 5
1 B s2-tag-expire0 get3 2.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:16:03.200 0 24
1 B s2-tag-single warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 167
1 B s2-tag-single warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:16:04.185 0 20
1 B s2-tag-single webhook 1.7 webhook /api/revalidate:tag-single 200 - - - 0 17
1 B s2-tag-single get1 1.9 browser /blog/wordpress-7-2-beta-4 200 - old 10:14:16.175 1 34 cache-control=private postponed
1 B s2-tag-single get2 2.0 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:16:05.708 0 8
1 B s2-tag-single get3 2.2 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:16:05.708 0 9
1 B s3-hygiene warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 177
1 B s3-hygiene warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:16:06.657 0 11
1 B s3-hygiene bad-secret 1.7 webhook /api/revalidate:tag-expire0 401 - - - 0 21
1 B s3-hygiene get1 1.9 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:16:06.657 0 6
1 B s3-hygiene valid-1 2.0 webhook /api/revalidate:tag-expire0 200 - - - 0 19
1 B s3-hygiene valid-2 2.2 webhook /api/revalidate:tag-expire0 200 - - - 0 10
1 B s3-hygiene get2 2.4 browser /blog/wordpress-7-2-beta-4 200 - old 10:14:16.175 1 48 cache-control=private postponed
1 B s3-hygiene get3 2.6 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:16:08.728 0 7
1 B s4-unpublish warm1 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 176
1 B s4-unpublish warm2 1.5 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:16:09.510 0 24
1 B s4-unpublish webhook 1.7 webhook /api/revalidate:tag-expire0 200 - - - 0 34
1 B s4-unpublish get1 1.9 browser /blog/wordpress-7-2-beta-4 200 - old 10:14:16.175 1 39 cache-control=private postponed
1 B s4-unpublish get2 2.1 browser /blog/wordpress-7-2-beta-4 404 HIT none - 0 7
1 B s5-uncached get1 0.4 browser /blog/critical-php-security-release 200 - old 10:16:11.876 1 215 cache-control=private postponed
1 B s5-uncached get2 0.5 browser /blog/critical-php-security-release 200 HIT old 10:16:11.876 0 9
1 B s6-hang warm1 0.3 browser /blog/wordpress-7-1-4 200 STALE old 10:14:16.181 1 184
1 B s6-hang warm2 1.5 browser /blog/wordpress-7-1-4 200 HIT old 10:16:12.654 0 6
1 B s6-hang warm1 32.7 browser /blog/wordpress-7-2-beta-2 200 STALE old 10:14:16.182 1 25
1 B s6-hang warm2 33.9 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:16:45.001 0 18
1 B s6-hang mode 33.9 origin hang
1 B s6-hang browser-fresh 34.1 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:16:45.001 0 14
1 B s6-hang browser-stale 34.3 browser /blog/wordpress-7-1-4 200 STALE old 10:16:12.654 1 28
1 B s6-hang browser-uncached 39.4 browser /blog/critical-php-security-release 200 - none - 1 5036 cache-control=private postponed
1 B s6-hang googlebot-fresh 39.6 googlebot /blog/wordpress-7-2-beta-2 200 HIT old 10:16:45.001 0 4
1 B s6-hang googlebot-stale 39.8 googlebot /blog/wordpress-7-1-4 200 HIT old 10:16:12.654 0 3
1 B s6-hang googlebot-uncached 44.9 googlebot /blog/critical-php-security-release 200 - none - 1 5018 cache-control=private postponed
1 B s6-hang bingbot-fresh 45.1 bingbot /blog/wordpress-7-2-beta-2 200 - old 10:16:45.001 0 11 cache-control=private
1 B s6-hang bingbot-stale 50.3 bingbot /blog/wordpress-7-1-4 200 - none - 1 5031 cache-control=private
1 B s6-hang bingbot-uncached 55.5 bingbot /blog/critical-php-security-release 200 - none - 1 5024 cache-control=private
1 B s6-hang origin: 5 hung requests, 5 closed by the client before recovery, after 4998,4996,5001,5003,4999 ms
1 B s6-hang recover1 56.1 browser /blog/wordpress-7-1-4 200 HIT old 10:16:12.654 0 11
1 B s6-hang recover2 56.3 browser /blog/wordpress-7-1-4 200 HIT old 10:16:12.654 0 24
1 B s6-hang recover3 56.5 browser /blog/critical-php-security-release 200 - old 10:17:08.812 1 31 cache-control=private postponed
1 B s6-refuse warm1 0.3 browser /blog/wordpress-7-1-4 200 STALE old 10:14:16.181 1 174
1 B s6-refuse warm2 1.5 browser /blog/wordpress-7-1-4 200 HIT old 10:17:09.430 0 11
1 B s6-refuse warm1 32.7 browser /blog/wordpress-7-2-beta-2 200 STALE old 10:14:16.182 1 42
1 B s6-refuse warm2 33.9 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:17:41.810 0 18
1 B s6-refuse mode 33.9 origin refuse
1 B s6-refuse browser-fresh 34.1 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:17:41.810 0 4
1 B s6-refuse browser-stale 34.2 browser /blog/wordpress-7-1-4 200 STALE old 10:17:09.430 0 6
1 B s6-refuse browser-uncached 34.4 browser /blog/critical-php-security-release 200 - none - 0 31 cache-control=private postponed
1 B s6-refuse googlebot-fresh 34.6 googlebot /blog/wordpress-7-2-beta-2 200 HIT old 10:17:41.810 0 10
1 B s6-refuse googlebot-stale 34.7 googlebot /blog/wordpress-7-1-4 200 HIT old 10:17:09.430 0 6
1 B s6-refuse googlebot-uncached 34.9 googlebot /blog/critical-php-security-release 200 - none - 0 22 cache-control=private postponed
1 B s6-refuse bingbot-fresh 35.1 bingbot /blog/wordpress-7-2-beta-2 200 - old 10:17:41.810 0 20 cache-control=private
1 B s6-refuse bingbot-stale 35.3 bingbot /blog/wordpress-7-1-4 200 - none - 0 32 cache-control=private
1 B s6-refuse bingbot-uncached 35.4 bingbot /blog/critical-php-security-release 200 - none - 0 14 cache-control=private
1 B s6-refuse recover1 36.1 browser /blog/wordpress-7-1-4 200 HIT old 10:17:09.430 0 5
1 B s6-refuse recover2 36.3 browser /blog/wordpress-7-1-4 200 HIT old 10:17:09.430 0 17
1 B s6-refuse recover3 36.5 browser /blog/critical-php-security-release 200 - old 10:17:45.596 1 40 cache-control=private postponed
1 B s6-503 warm1 0.3 browser /blog/wordpress-7-1-4 200 STALE old 10:14:16.181 1 166
1 B s6-503 warm2 1.5 browser /blog/wordpress-7-1-4 200 HIT old 10:17:46.223 0 23
1 B s6-503 warm1 32.7 browser /blog/wordpress-7-2-beta-2 200 STALE old 10:14:16.182 1 10
1 B s6-503 warm2 33.8 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:18:18.581 0 4
1 B s6-503 mode 33.8 origin 503
1 B s6-503 browser-fresh 34.0 browser /blog/wordpress-7-2-beta-2 200 HIT old 10:18:18.581 0 4
1 B s6-503 browser-stale 34.2 browser /blog/wordpress-7-1-4 200 STALE old 10:17:46.223 1 6
1 B s6-503 browser-uncached 34.3 browser /blog/critical-php-security-release 200 - none - 1 27 cache-control=private postponed
1 B s6-503 googlebot-fresh 34.5 googlebot /blog/wordpress-7-2-beta-2 200 HIT old 10:18:18.581 0 6
1 B s6-503 googlebot-stale 34.7 googlebot /blog/wordpress-7-1-4 200 HIT old 10:17:46.223 0 4
1 B s6-503 googlebot-uncached 34.8 googlebot /blog/critical-php-security-release 200 - none - 1 24 cache-control=private postponed
1 B s6-503 bingbot-fresh 35.0 bingbot /blog/wordpress-7-2-beta-2 200 - old 10:18:18.581 0 12 cache-control=private
1 B s6-503 bingbot-stale 35.2 bingbot /blog/wordpress-7-1-4 200 - none - 1 17 cache-control=private
1 B s6-503 bingbot-uncached 35.4 bingbot /blog/critical-php-security-release 200 - none - 1 18 cache-control=private
1 B s6-503 recover1 36.0 browser /blog/wordpress-7-1-4 200 HIT old 10:17:46.223 0 4
1 B s6-503 recover2 36.2 browser /blog/wordpress-7-1-4 200 HIT old 10:17:46.223 0 3
1 B s6-503 recover3 36.4 browser /blog/critical-php-security-release 200 - old 10:18:22.240 1 16 cache-control=private postponed
1 B s9-two warm1 1.1 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 918
1 B s9-two warm2 2.2 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:18:27.093 0 5
1 B s9-two warm1 2.4 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 53
1 B s9-two warm2 3.6 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:18:28.460 0 5
1 B s9-two webhook 3.8 webhook /api/revalidate:tag-expire0 200 - - - 0 17 port=3001
1 B s9-two i1-get1 4.0 browser /blog/wordpress-7-2-beta-4 200 - old 10:14:16.175 1 29 cache-control=private postponed port=3001
1 B s9-two i1-get2 4.1 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:18:29.964 0 5 port=3001
1 B s9-two i2-get 4.3 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:18:28.460 0 23 port=3002
1 B s9-two i2-after1 34.8 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:18:28.460 1 10 port=3002
1 B s9-two i2-after2 34.9 browser /blog/wordpress-7-2-beta-4 200 HIT new 10:19:00.783 0 5 port=3002
1 B s11-draft no-cookie 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 166
1 B s11-draft bad-secret 0.5 browser /api/draft?secret=wrong-preview-secret&slug=/blog/wordpress-7-2-beta-4 401 - none - 0 26
1 B s11-draft enable 0.7 browser /api/draft?secret=ok 307 - - - 0 175 location=/blog/wordpress-7-2-beta-4 set-cookie=__prerender_bypass
1 B s11-draft with-cookie 0.9 browser /blog/wordpress-7-2-beta-4 200 HIT draft 10:19:02.037 1 20 cache-control=private
1 B s11-draft origin-auth yes
1 B s11-draft visitor 1.0 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:19:01.520 0 4
1 B s11-draft disable 1.0 browser /api/draft/disable 200 - - - 0 0 set-cookie=__prerender_bypass=; Path=/
1 B s11-draft-nocred no-cookie 0.3 browser /blog/wordpress-7-2-beta-4 200 STALE old 10:14:16.175 1 168
1 B s11-draft-nocred enable 0.5 browser /api/draft?secret=ok 307 - - - 0 175 location=/blog/wordpress-7-2-beta-4 set-cookie=__prerender_bypass
1 B s11-draft-nocred with-cookie 0.7 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:19:03.152 1 25 cache-control=private
1 B s11-draft-nocred origin-auth no
1 B s11-draft-nocred visitor 0.9 browser /blog/wordpress-7-2-beta-4 200 HIT old 10:19:02.813 0 12
1 B s11-draft-nocred disable 0.9 browser /api/draft/disable 200 - - - 0 0 set-cookie=__prerender_bypass=; Path=/
1 B s12-images local-ip 400 cache-control=- | body: "url" parameter is not allowed
1 B s12-images wordpress.org 200 cache-control=public, max-age=315360000, must-revalidate | 10806 bytes image/jpeg
1 B s12-images unlisted-host 400 cache-control=- | body: "url" parameter is not allowed
1 B s12-images trailing-slash 2.8 browser /blog/wordpress-7-2-beta-4/ 308 - none - 0 2 location=/blog/wordpress-7-2-beta-4
1 B s12-images old-permalink-row1 source=/2026/11/wordpress-7-2-beta-4/ | 308 /2026/11/wordpress-7-2-beta-4/ then 404 /2026/11/wordpress-7-2-beta-4
1 B s12-images old-permalink-row2 source=/2026/10/wordpress-7-1-4 | 308 /2026/10/wordpress-7-1-4/ then 308 /2026/10/wordpress-7-1-4 then 200 /blog/wordpress-7-1-4
1 B s6-expired browser 310.2 browser /blog/wordpress-7-2-beta-4 500 - none - 1 5047 cache-control=private port=3005
1 B s6-expired bingbot 315.4 bingbot /blog/wordpress-7-2-beta-4 200 - none - 1 5040 cache-control=private port=3005
1 B s10-restart restart-browser 0.4 browser /blog/wordpress-7-2-beta-4 500 - none - 0 197 cache-control=private page_age_s=351
1 B s10-restart restart-googlebot 0.5 googlebot /blog/wordpress-7-2-beta-4 200 HIT old 10:14:16.175 0 8 page_age_s=351
1 B s10-restart restart-bingbot 0.7 bingbot /blog/wordpress-7-2-beta-4 200 - none - 0 53 cache-control=private page_age_s=351
1 B s10-restart restart-uncached 1.0 browser /blog/critical-php-security-release 200 - none - 0 64 cache-control=private postponed
1 B s10-restart next-build-origin-refused exit=1 in 7861 ms | ⨯ [TypeError: fetch failed] {
1 - s8-api post slug=tiled-gallery
1 - s8-api rest-post 200 5151 bytes 694 ms | cache-control=max-age=600, must-revalidate x-cache=HIT: 1 x-cacheable=SHORT cf-cache-status=DYNAMIC age=-
1 - s8-api rest-author 200 735 bytes 654 ms | cache-control=max-age=600, must-revalidate x-cache=HIT: 1 x-cacheable=SHORT cf-cache-status=DYNAMIC age=-
1 - s8-api rest-categories 200 2102 bytes 1206 ms | cache-control=max-age=600, must-revalidate x-cache=HIT: 1 x-cacheable=SHORT cf-cache-status=DYNAMIC age=-
1 - s8-api rest-embed 200 7728 bytes 894 ms | cache-control=max-age=600, must-revalidate x-cache=HIT: 1 x-cacheable=SHORT cf-cache-status=DYNAMIC age=-
1 - s8-api rest-embed-fields 200 6815 bytes 572 ms | cache-control=max-age=600, must-revalidate x-cache=HIT: 1 x-cacheable=SHORT cf-cache-status=DYNAMIC age=-
1 - s8-api graphql-get 200 3624 bytes 1306 ms | cache-control=max-age=600, must-revalidate x-cache=HIT: 1 x-cacheable=SHORT cf-cache-status=DYNAMIC age=-
1 - s8-api graphql-post 200 3624 bytes 520 ms | cache-control=- x-cache=- x-cacheable=- cf-cache-status=DYNAMIC age=-
1 - s8-api same title, author and categories both ways: yes ["Tiled Gallery","Jared Erickson","Gallery|Images|Jetpack"]
summary
A s1 time-based: first title_seen=new at t=32.2 (HIT); edit at t=10, page generated at warm2
A s2 path: webhook 200 in 31 ms, origin hits during webhook 0; gets: new/MISS/16ms/+1, new/HIT/7ms/+0, new/HIT/6ms/+0
A s2 tag-max: webhook 200 in 40 ms, origin hits during webhook 0; gets: old/STALE/41ms/+1, new/HIT/6ms/+0, new/HIT/11ms/+0
A s2 tag-expire0: webhook 200 in 46 ms, origin hits during webhook 0; gets: new/MISS/26ms/+1, new/HIT/6ms/+0, new/HIT/18ms/+0
A s2 tag-single: webhook 200 in 37 ms, origin hits during webhook 0; gets: new/MISS/20ms/+1, new/HIT/6ms/+0, new/HIT/13ms/+0
A s3 hygiene: wrong secret 401, next get old; duplicate webhooks 200/200; gets after: new/+1, new/+0
A s4 unpublish + tag-expire0: get1 404 none, get2 404 none
A s5 never-cached slug: get1 200 MISS +1, get2 200 HIT +0
A s6-hang: browser fresh 200/old/12ms; browser stale 200/old/30ms; browser uncached 500/none/5047ms; googlebot fresh 200/old/4ms; googlebot stale 200/old/5ms; googlebot uncached 500/none/5052ms; bingbot fresh 200/old/17ms; bingbot stale 200/old/5ms; bingbot uncached 500/none/5033ms; after recovery: 200/old, 200/old, 200/old
A s6-refuse: browser fresh 200/old/8ms; browser stale 200/old/26ms; browser uncached 500/none/19ms; googlebot fresh 200/old/16ms; googlebot stale 200/old/4ms; googlebot uncached 500/none/25ms; bingbot fresh 200/old/13ms; bingbot stale 200/old/17ms; bingbot uncached 500/none/17ms; after recovery: 200/old, 200/old, 200/old
A s6-503: browser fresh 200/old/3ms; browser stale 200/old/11ms; browser uncached 500/none/16ms; googlebot fresh 200/old/28ms; googlebot stale 200/old/4ms; googlebot uncached 500/none/18ms; bingbot fresh 200/old/6ms; bingbot stale 200/old/8ms; bingbot uncached 500/none/21ms; after recovery: 200/old, 200/old, 200/old
A s9 two instances, webhook to 3001 only: 3001 new then new, 3002 old; 3002 after its window: old/STALE, then new/HIT
A s11-draft: enable 307, with cookie draft (HIT, origin auth yes), visitor without cookie old
A s11-draft-nocred: enable 307, with cookie old (HIT, origin auth no), visitor without cookie old
A s12: image local-ip 400, wordpress.org 200, unlisted host 400; /blog/<slug>/ 308 location=/blog/wordpress-7-2-beta-4; row 1 (source with slash): 308 /2026/11/wordpress-7-2-beta-4/ then 404 /2026/11/wordpress-7-2-beta-4; row 2 (source without slash): 308 /2026/10/wordpress-7-1-4/ then 308 /2026/10/wordpress-7-1-4 then 200 /blog/wordpress-7-1-4
A s6-expired (page generated 305.2 s earlier, origin hanging): browser 200/old/8ms, bingbot 200/old/4ms
A s10 restart with origin refused (page age 341 s): browser 200/old, googlebot 200/old, bingbot 200/old, uncached 500/none; next build exit 1
B s1 time-based: first title_seen=new at t=32.2 (HIT); edit at t=10, page generated at warm2
B s2 path: webhook 200 in 16 ms, origin hits during webhook 0; gets: old/-/27ms/+1, new/HIT/5ms/+0, new/HIT/7ms/+0
B s2 tag-max: webhook 200 in 32 ms, origin hits during webhook 0; gets: old/STALE/16ms/+1, new/HIT/13ms/+0, new/HIT/10ms/+0
B s2 tag-expire0: webhook 200 in 16 ms, origin hits during webhook 0; gets: old/-/33ms/+1, new/HIT/5ms/+0, new/HIT/24ms/+0
B s2 tag-single: webhook 200 in 17 ms, origin hits during webhook 0; gets: old/-/34ms/+1, new/HIT/8ms/+0, new/HIT/9ms/+0
B s3 hygiene: wrong secret 401, next get old; duplicate webhooks 200/200; gets after: old/+1, new/+0
B s4 unpublish + tag-expire0: get1 200 old, get2 404 none
B s5 never-cached slug: get1 200 - +1, get2 200 HIT +0
B s6-hang: browser fresh 200/old/14ms; browser stale 200/old/28ms; browser uncached 200/none/5036ms; googlebot fresh 200/old/4ms; googlebot stale 200/old/3ms; googlebot uncached 200/none/5018ms; bingbot fresh 200/old/11ms; bingbot stale 200/none/5031ms; bingbot uncached 200/none/5024ms; after recovery: 200/old, 200/old, 200/old
B s6-refuse: browser fresh 200/old/4ms; browser stale 200/old/6ms; browser uncached 200/none/31ms; googlebot fresh 200/old/10ms; googlebot stale 200/old/6ms; googlebot uncached 200/none/22ms; bingbot fresh 200/old/20ms; bingbot stale 200/none/32ms; bingbot uncached 200/none/14ms; after recovery: 200/old, 200/old, 200/old
B s6-503: browser fresh 200/old/4ms; browser stale 200/old/6ms; browser uncached 200/none/27ms; googlebot fresh 200/old/6ms; googlebot stale 200/old/4ms; googlebot uncached 200/none/24ms; bingbot fresh 200/old/12ms; bingbot stale 200/none/17ms; bingbot uncached 200/none/18ms; after recovery: 200/old, 200/old, 200/old
B s9 two instances, webhook to 3001 only: 3001 old then new, 3002 old; 3002 after its window: old/STALE, then new/HIT
B s11-draft: enable 307, with cookie draft (HIT, origin auth yes), visitor without cookie old
B s11-draft-nocred: enable 307, with cookie old (HIT, origin auth no), visitor without cookie old
B s12: image local-ip 400, wordpress.org 200, unlisted host 400; /blog/<slug>/ 308 location=/blog/wordpress-7-2-beta-4; row 1 (source with slash): 308 /2026/11/wordpress-7-2-beta-4/ then 404 /2026/11/wordpress-7-2-beta-4; row 2 (source without slash): 308 /2026/10/wordpress-7-1-4/ then 308 /2026/10/wordpress-7-1-4 then 200 /blog/wordpress-7-1-4
B s6-expired (page generated 310.2 s earlier, origin hanging): browser 500/none/5047ms, bingbot 200/none/5040ms
B s10 restart with origin refused (page age 351 s): browser 500/none, googlebot 200/old, bingbot 200/none, uncached 200/none; next build exit 1
s8 REST: 3 requests 7988 bytes; REST _embed: 1 request 7728 bytes; REST _embed+_fields: 1 request 6815 bytes; WPGraphQL GET: 1 request 3624 bytes; WPGraphQL POST: 1 request 3624 bytes

Frequently asked questions

Do I need WPGraphQL for headless WordPress with Next.js?

No. The WordPress REST API ships with WordPress, and WPGraphQL is a free plugin you add. On demo.wpgraphql.com on 2026-11-09, one post page's data (title, content, author, categories) took 3 REST requests and 7,988 bytes, 1 REST request and 7,728 bytes with _embed, or 1 WPGraphQL query and 3,624 bytes. Use the REST API for simple post pages, and WPGraphQL when pages join several content types.

How does Next.js know a WordPress post changed?

A WordPress hook tells it: transition_post_status sends a POST to a Next.js route handler, which checks a secret and calls revalidateTag for the post's tag. Our test sent that webhook from a script, not from WordPress. On Next.js 16.4.5, after a 'max' webhook the first visitor got the old title. With { expire: 0 }, Cache Components off served the new title at once, and Cache Components on served the next build copy once.

What happens to a headless WordPress site when WordPress is down?

Pages Next.js has already cached keep serving their last good version, and pages it never cached have nothing to fall back on. In our Next.js 16.4.5 test against a local WordPress API replay that hung, refused connections or returned 503, cached pages returned 200 to browsers and Googlebot. A never-cached post returned a 500 with Cache Components off, and a 200 holding only a loading placeholder with Cache Components on.

How do I preview WordPress drafts in Next.js?

Use Next.js Draft Mode, which superseded Preview Mode, plus an authenticated request for the draft. A route handler checks a preview secret, calls draftMode().enable() and redirects to the post, and the page asks WordPress for the draft with an Application Password over Basic auth. In our test the cookie alone still showed the published title. With the credential it showed the draft, and visitors without the cookie still saw the published post.

Does headless WordPress hurt SEO?

Not if you rebuild what the theme and SEO plugin did: metadata and schema from Yoast's yoast_head_json, canonicals on the Next.js domain, an API-built sitemap, a noindexed WordPress front end and redirects in Next.js. In our test, a redirect source copied with WordPress's trailing slash ended in a 404, because Next.js strips the slash first. With Cache Components on, a Bingbot user agent got a placeholder for a stale post during our outage, while browsers got the post.

Do I need Faust.js for headless WordPress?

Not for an App Router build. As of 2026-11-09, the Faust.js README lists Next.js 12.1.6 or newer with the Pages Router and does not mention the App Router. Its experimental App Router package is deprecated, and WP Engine says App Router support will come in its newer Headless WordPress Toolkit. What this guide needs, a Draft Mode entry route, an authenticated draft fetch and a revalidation webhook, is a few dozen lines of route handlers.

Next articleWooCommerce to Shopify Migration Checklist: The URLs Shopify Won't Redirect

Get in touch.

Whether you have questions or just want to explore what's possible, we're here to help.