Fourteen minutes of text/x-component
How one test request made Cloudflare serve text/x-component, a Next.js RSC payload, as my /writing page for about 14 minutes, and why my bypass rule lost.
this post
- published
- 2026-10-03
- updated
- 2026-11-26
- reading
- 07 min
- parts
- 12
The short version
text/x-component is the content type of a React Server Components (RSC) payload: the data that the Next.js router fetches for client navigation. If a page URL returns it in place of HTML, a cache in front of the app stored the payload under the URL of the page. That happened to my /writing page for about 14.5 minutes on 3 October 2026, and the fix was the order of three Cache Rules in Cloudflare.
What is text/x-component?
Next.js serves two responses at one URL. A normal request gets HTML. A request with the header rsc: 1 gets the RSC payload, and its content-type is text/x-component. In the network panel of a browser that is normal, because the router asks for the payload on client navigation; as the answer to a plain page request it is a fault, because a browser cannot show it as a page.
| Request | Content type | Who it is for |
|---|---|---|
GET /writing | text/html | a browser that loads the page |
GET /writing with rsc: 1 | text/x-component | the Next.js router, on client navigation |
This is a blameless postmortem. The request that caused it was my own validation check.
How do you fix a page that returns text/x-component?
These steps are for Next.js behind Cloudflare, because that is the setup I broke and repaired. Step 1 uses this command:
curl -s -o /dev/null -D - https://goksen.ing/writing |
grep -iE 'content-type|cf-cache-status'- Confirm it with a plain GET. Read two headers:
content-typeandcf-cache-status.text/x-componentwithHITmeans that the cache holds the payload under the URL of the page. Use GET for this, notcurl -I. - Put the HTML cache rule first, and the bypass rules after it. Cache Rules stack, and the last matching rule wins.
- Keep RSC requests out of the HTML key. Bypass the cache for a request with an
rscheader, turn on the Cache Rules Vary setting for it, or both. - Store only a 200. Set every other status code to no store.
- Then purge everything. Purge after the rules are correct, or a request like mine can store the payload again. A purge of the single URL did not clear my page. Cloudflare's docs name a remedy for the single-file purge: a rule expression that matches the
PURGEmethod too. - Purge on every production deploy, and watch the first real run of that workflow.
- Probe with GET on throwaway URLs. Never send RSC headers to a real page through the cache.
The rule list that I ended with, and the probable reason that the single-URL purge failed, are under The fix.
What happened
On 3 October 2026, a plain GET of my /writing page returned content-type: text/x-component with cf-cache-status: HIT. That is the React Server Component (RSC) payload of the page, the data that the Next.js router uses for client navigation, not the HTML. A browser cannot show it as a page.
It lasted from about 15:56:56 to 16:11:31 UTC, about 14.5 minutes, in the one Cloudflare data center that I could see (Amsterdam). I cannot say how many visitors got it: the cache works per data center, and a response that is not HTML carries no analytics beacon.
The setup
goksen.ing runs on Vercel. Cloudflare sits in front of it for DNS, the proxy, an HTML cache, and cookieless analytics. At the time, three Cache Rules ran in this order:
1 Bypass ACME challenge path starts with /.well-known/acme-challenge/
-> bypass cache
2 Bypass RSC / prefetch query contains _rsc, or header rsc exists,
or header next-router-prefetch exists
-> bypass cache
3 Cache HTML host goksen.ing, GET, not /_next/image,
not opengraph-image -> eligible for cache,
ignore cache-control, 1 month; 200 -> 1 monthVercel tells caches about the two responses of a URL: it sends vary: rsc, next-router-state-tree, next-router-prefetch, next-router-segment-prefetch.
Timeline
15:12:59 production deploy; the purge workflow fails: no secrets yet
15:53:04 the CLOUDFLARE_ZONE_ID secret is set, with a wrong value
15:56:54 validation request: GET /writing, RSC: 1
-> text/x-component, MISS; Cloudflare stores it
15:57:20 plain GET /writing -> text/x-component, HIT
15:57:35 the purge workflow, run again, fails: 10000
16:03:52 single-URL purge of /writing; at 16:04:25 still the payload
16:09 Cache HTML moves first; 300 and up are not stored
16:11:31 Purge Everything; at 16:11:44 /writing is HTML again
16:22:58 the zone ID secret is corrected
16:23:04 the purge workflow: "Purged the zone."Cause
Three things lined up.
Cloudflare ignores Vary by default. It uses Vary for compression and, on paid plans, for image formats. Since July 2026, a Cache Rule can turn on a Vary setting, but mine did not. So the HTML and the RSC payload of /writing had one cache key: the URL.
Cache Rules stack, and the last match wins. Every matching rule applies, in order. When two rules set the same thing, the later rule wins. My request matched rule 2 (bypass) and rule 3 (cache), and rule 3 came last. The bypass rule never had a chance. The same check showed it for the other bypass rules too: /?_rsc=abc gave HIT, and the ACME path stored its 404.
┌───────┐ ┌─────────────────┐ ┌────────┐ ┌─────────┐
│ probe │ │ cloudflare edge │ │ vercel │ │ visitor │
└───┬───┘ └────────┬────────┘ └────┬───┘ └────┬────┘
│ │ │ │
│ GET /writing, rsc: 1 │ │ │
│───────────────────────── │ │
│ │ │ │
│ ┌─────────────────────────┐ │ │
│ │ Cache HTML matches last │ │ │
│ └─────────────────────────┘ │ │
│ │ │ │
│ │ GET /writing, rsc: 1 │ │
│ │───────────────────────── │
│ │ │ │
│ │ 200 text/x-component │ │
│ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌│ │
│ │ │ │
│ ┌────────────────────┐ │ │
│ │ stored as /writing │ │ │
│ └────────────────────┘ │ │
│ │ │ │
│ │ GET /writing │ │
│ ──────────────────────────────────────│
│ │ │ │
│ │ HIT: RSC payload │
│ │╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
│ │ │ │
┌───┴───┐ ┌────────┴────────┐ ┌────┴───┐ ┌────┴────┐
│ probe │ │ cloudflare edge │ │ vercel │ │ visitor │
└───────┘ └─────────────────┘ └────────┘ └─────────┘Only a hand-made request could reach the plain key. The Next.js client adds a _rsc query to every RSC fetch: a hash of the router headers. So a browser's RSC request has its own cache key, /writing?_rsc=…, and cannot overwrite the page. My validation request had rsc: 1 and no _rsc. Next.js has a guard for this case: it redirects an RSC request whose _rsc does not match. On Vercel, the guard did not run for my request; the answer was a 200 with the payload.
┌────────────────────────────────────┐ ┌────────────────────────────────────┐ │ before: Cache HTML last │ │ after: Cache HTML first │ │ │ │ │ │ │ │ │ │ ┌────────────────────────────────┐ │ │ ┌────────────────────────────────┐ │ │ │ │ │ │ │ │ │ │ │ GET /writing rsc: 1 │ │ │ │ GET /writing rsc: 1 │ │ │ │ │ │ │ │ │ │ │ └────────────────┬───────────────┘ │ │ └────────────────┬───────────────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌────────────────────────────────┐ │ │ ┌────────────────────────────────┐ │ │ │ │ │ │ │ │ │ │ │ 1 Bypass ACME no match │ │ │ │ 1 Cache HTML match: cache │ │ │ │ │ │ │ │ │ │ │ └────────────────┬───────────────┘ │ │ └────────────────┬───────────────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌────────────────────────────────┐ │ │ ┌────────────────────────────────┐ │ │ │ │ │ │ │ │ │ │ │ 2 Bypass RSC match: bypass │ │ │ │ 2 Bypass ACME no match │ │ │ │ │ │ │ │ │ │ │ └────────────────┬───────────────┘ │ │ └────────────────┬───────────────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌────────────────────────────────┐ │ │ ┌────────────────────────────────┐ │ │ │ │ │ │ │ │ │ │ │ 3 Cache HTML match: cache │ │ │ │ 3 Bypass RSC match: bypass │ │ │ │ │ │ │ │ │ │ │ └────────────────┬───────────────┘ │ │ └────────────────┬───────────────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌────────────────────────────────┐ │ │ ┌────────────────────────────────┐ │ │ │ │ │ │ │ │ │ │ │ last match wins: cached │ │ │ │ last match wins: bypassed │ │ │ │ │ │ │ │ │ │ │ └────────────────────────────────┘ │ │ └────────────────────────────────┘ │ │ │ │ │ └────────────────────────────────────┘ └────────────────────────────────────┘
Two more problems from the same check
A 404 could stay cached for up to a month. The Cache HTML rule ignored cache-control, and it had one status code row: 200 -> 1 month. A 404 matched no row, so it took the rule's one-month TTL. /nope went MISS, then HIT. A page that I add later could have stayed a 404 at that data center until the entry expired or a purge removed it.
The purge on deploy failed with 10000. A GitHub Actions workflow purges the zone after each production deploy. It failed with 10000 Authentication error. My first guess was the token type. It was the zone ID: the secret held a wrong value. The error does not tell you which part is wrong, because a valid token also gets 10000 for a zone outside its resources. The proof was simple: the same token with the correct zone ID purged one unused URL from my laptop, and the next run, with only the zone ID changed, purged the zone. One more trap on the way: an account-owned token verifies at /accounts/<account_id>/tokens/verify, not at /user/tokens/verify.
The fix
- Cache HTML moved first. The bypass rules now come after it, so they win when they match.
- Only a 200 is stored. Two status code rows:
>= 300 -> no storeand201–299 -> no store. - Purge Everything. The single-URL purge did not clear
/writing. Cloudflare's docs warn that it may not work when a Cache Rule matches only GET requests, and mine does. That is the probable reason. - The zone ID corrected. The purge has run on every production deploy since.
- A second layer: Vary. The Cache HTML rule now turns on the Vary setting, so
rscis part of the cache key even if the rule order breaks again.
1 Cache HTML as before; 200 -> 1 month,
>= 300 and 201–299 -> no store;
Vary: rsc and default -> raw header values
2 Bypass ACME challenge -> bypass cache
3 Bypass RSC / prefetch -> bypass cacheon: deployment_status
jobs:
purge:
if: >-
github.event.deployment_status.state == 'success' &&
github.event.deployment.environment == 'Production'
runs-on: ubuntu-latest
steps:
- name: Purge the Cloudflare zone
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
run: |
response=$(curl --silent --show-error --retry 3 --request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{"purge_everything":true}' \
"https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache")
jq -e '.success' <<<"$response" > /dev/nullWhat I changed in how I work
- Every probe goes to a throwaway URL. I run these checks by hand and with AI agents (I stopped writing code this year), and the rule is the same for both: a request with RSC headers goes only to a URL with a unique query, never to a real page.
- GET, not
curl -I. My cache rule matches GET only, so a HEAD request always showsDYNAMICand tells you nothing. - I read the rule list as a program. It runs from top to bottom, and the last write wins. The order is part of the logic.
- On
10000, I check the zone too. The error names the credential, but the cause can be the resource.
# A unique query is its own cache key.
url="https://goksen.ing/writing?probe=$RANDOM$RANDOM"
curl -s -o /dev/null -D - -H 'RSC: 1' "$url" | grep -i cf-cache-status
# A plain GET of the real page: is it still HTML?
curl -s -o /dev/null -D - https://goksen.ing/writing |
grep -iE 'content-type|cf-cache-status'Should you cache HTML in front of Next.js?
Cache HTML at a proxy only if you will own two things: the order of the rules, and the rsc header as part of what a page is. If nobody will check those two after each change, leave the HTML out of the proxy cache and let the host serve it.
Vercel does not recommend a reverse proxy in front of a Vercel project. I chose it anyway, because I want DNS, the edge cache and the analytics in one stack. The price is one more program to read: the rule list.
Questions
What is text/x-component? The content type of a React Server Components payload. Next.js sends it to a request that has the header rsc: 1, and the router uses it for client navigation.
Why does a page return text/x-component in place of HTML? A cache stored the RSC response under the URL of the page, and now serves it to plain requests. On my site the cache key was the URL alone, and my bypass rule for RSC requests lost to a cache rule that came after it.
Where does an account-owned Cloudflare API token verify? At /accounts/<account_id>/tokens/verify, not at /user/tokens/verify. If a purge still fails with 10000 Authentication error, check the zone ID too: a valid token gets the same error for a zone outside its resources.