I want to deploy a next project outside of Vercel and am confused how cache is working. When accessing the url for a page with ISR enabled I can confirm the db is in fact not accessed before the revalidate period isn't over but
First question: The generated page seems to live in.next/server/pages/mypage.html (and mypage.json) however when checking the devtools after requesting the page's url I can only see multiple requests to.next/static/* and.next/static/chunks/pages/* which seems to be files generated at build time that don't know anything about what has been regenerated by ISR when accessing the database, I can't find anything related to.next/server/pages. Can someone explain me that?
Second question: If it's accessed from.next/server is it possible to cache through a CDN since NextJS' docs advice just to host.next/static on the CDN?
The exact configuration for uploading your files to a given CDN will depend on your CDN of choice. The only folder you need to host on your CDN is the contents of.next/static/, which should be uploaded as _next/static/ as the above URL request indicates. Do not upload the rest of your.next/ folder, as you should not expose your server code and other configuration to the public.
https://nextjs.org/docs/api-reference/next.config.js/cdn-support-with-asset-prefix
Thanks in advance.
Serving without hitting the front of the NextJS app and instead pointing to its own internal cache defeats the ISG Setup in my understanding.
Consider the following flow:
./server
folder with a ISG generated page which was generated./server
with a corresponding update. Point to the front of the app not to the temporary storage in the /server
folder that Next uses to maintain ISG. Of course, this does not apply to /public
or /static
folders which host the JS and you can front via CDN
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.