The primary goal of Next.js is to minimize the distance between the user and the server. This is achieved through a Content Delivery Network.
When a route is rendered Statically, Next.js produces the HTML and RSC Payload during the build process. These files are pushed to the Edge Servers once user from region of edge server makes request for web page.
During next build, Next.js performs Static Analysis to categorize every route segment. This decision determines timing of rendering i.e. if the work is done once (at build) or for every user (at request).
Next.js assumes all routes are static until proven otherwise. The server renders the component once, and the resulting HTML and RSC Payload are frozen and pushed to the CDN. What do you mean by pushed to CDN ? The HTML and RSC Payload were supposed to be cached on Edge Server once user from that region makes request for it right ?
If a route depends on information that only exists at the moment of the visit, Next.js skips the CDN cache and executes the code on the Origin Server for every request.
The Opt-out Cascade: If a Layout is dynamic, the entire branch of the tree becomes dynamic. However, a dynamic Page can sit inside a static Layout.
There are specific APIs that force Next.js to switch to Dynamic Rendering because they require Request time context:
cookies(): Accessing user specific sessions or preferences.headers(): Inspecting incoming HTTP request data (e.g., Auth tokens).searchParams: URL query strings (e.g., ?query=next). Since query strings are infinite and unpredictable, they cannot be pre rendered at build time.ISR is the Hybrid model. It allows us to update static artifacts in the background without a full redeploy, using the Stale-While-Revalidate (SWR) pattern.
| Feature | Static Rendering | ISR | Dynamic Rendering |
|---|---|---|---|
| Delivery Point | CDN Edge | CDN Edge | Origin Server |
| Computation | Once (Build Time) | Background Periodic | Every Request |
| Latency | Extremely Low | Extremely Low | Variable |
| Data Freshness | Stale until rebuild | Background Refresh | 100% Real-time |
The Architectural Priority: Your goal as an architect is to maximize Static Rendering. This shifts the Compute Cost from the user's visit to the deployment phase. Use Dynamic Rendering only for private, user-specific data that cannot be cached on a public CDN.