How to run a Next.JS instance behind a CDN?

54 Views Asked by At

I have a project setup where I'm required to run my Next.JS app behind a CDN. With CDN I mean a more "classical" approach by simply caching the HTTP requests around the globe. Unfortunately it is not possible for us to rely EdgeWorker technology (which would be my favorite way to go). But to stick to this "old" setup.

I'm building a Next.JS (14) App for a complex WebPage consisting of about 100.000 sites where my apps pull layouts, translations etc. from a CMS and builds the site.

With these requirements I figured that SSG can't be the way to go here (build time etc.) and the ISR with caching approach from Next.JS seems like the way to go.

When running my site in production mode I see a lot of requests in the network tab. I understand those are the request for the react server components I use within my app. I don't have anything user (or anything else) specific there, so my guess is that it should be possible to cache those requests as well. I'm irritated by the query parameter Next.JS appends to the request (e.g. http://localhost:3000/card/EX1_607?_rsc=9ehs5).

Those is just one of the questions I'm currently looking into. I'm wondering if I'm planning on doing something that is completely discouraged or if someone already has experience with such a setup.

0

There are 0 best solutions below