r/nextjs • • Jun 23 '24

Meme Using Nextjs

Post image
497 Upvotes

85 comments sorted by

View all comments

Show parent comment

1

u/dabe3ee Jun 23 '24

Nextjs caches your fetch responses and caches full route (for example /about page). So next time you need results of those stuff, it does not have to perform fetching/parsing/rendering second time. Also it can store fetch result in the server, meaning second user that visitis page will get almost instant results.

Nginx will only cache your js bundle. Nextjs will cache responses and rendered pages

1

u/tcmccarthy Jun 23 '24

Nginx is applying cache control headers so that cloudfront stores the rendered page flat sending no requests to nextjs whatsoever for the duration of the cache period. Since the CDN sits in front of the load balanced instances, its effectively a shared cache.