Is it possible to use a reverse proxy or CDN in front of a page that uses suspense and RCS?
Unanswered
Ruffed Grouse posted this in #help-forum
Ruffed GrouseOP
I have a public page that I would like to hide behind a reverse proxy (RP) or CDN with a short cache lifetime. The page currently exports a non-async function and grabs data from a server component behind a suspense boundary and is exported as SSG at build.
Is possible to use a RP or CDN in this scenario? My understanding is that the server streams the updates to the client when the suspense is resolved, so I would imagine the answer is "no" since the client and server have no connection to each other if the client is being served by a cache layer. Is this correct or can a cached page still get streamed updates from the server?
Is possible to use a RP or CDN in this scenario? My understanding is that the server streams the updates to the client when the suspense is resolved, so I would imagine the answer is "no" since the client and server have no connection to each other if the client is being served by a cache layer. Is this correct or can a cached page still get streamed updates from the server?
3 Replies
Ruffed GrouseOP
I meant RSC not RCS 🙂
Black carp
i'm not 100% sure, but I would not think it would get the streame updates because the request wouldn't be hitting the server because of your cache in front of the next app. Its not like a websocket that the page picks up the connection after the page loads. The stream happens in the single HTTP request from the RSC. you would need to bust your cache to get the new content. I'm hoping someone else proves me wrong though
Spectacled bear
I'm not the most knowledgeable on this but I am hosting nextjs app on cloudflare pages and also have cloudflare set as a proxy. Suspense works perfectly fine for me with server components.