Prerendered static HTML does not get first HIT on Vercel #67076
Unanswered
bitttttten
asked this question in
Help
Replies: 1 comment 1 reply
-
Hi @bitttttten, have you ever found an answer to this question? I am struggling with the exact same issue... |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have some routes in the app route that get prerendered as static HTML, on the first visit to my Next.JS app hosted on Vercel, they take a short time to load and then after that they are instant. They get "PRERENDER"ed, and then subsequent visits, I see "HIT"s.
In my logs I see:
However after deploying, I can see the
x-vercel-cache
is set to PRERENDER:curl -I https://my-website.com/large/bgs/ HTTP/2 200 accept-ranges: bytes access-control-allow-origin: * age: 0 cache-control: public, max-age=0, must-revalidate x-matched-path: /large/bgs/ x-vercel-cache: PRERENDER
I've omitted some headers.
If I cURL again:
curl -I https://my-website.com/large/bgs/ HTTP/2 200 accept-ranges: bytes access-control-allow-origin: * age: 52 cache-control: public, max-age=0, must-revalidate x-matched-path: /large/bgs/ x-vercel-cache: HIT
I can also see that in the logs, if I do some console.log-ing or look in our telemetry, Vercel is actually rendering this page. In my mind, we've pre-rendered the page so why does it need to render again after deploying?
I now get a HIT on the Vercel Edge Network.
Locally I do get cache hits immediately:
npm run build; npm run start
Now you can see the HIT:
Any help is appreciated.
Additional information
My next.config.js:
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions