Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Latest commit

 

History

History
23 lines (14 loc) · 1.18 KB

architecture.md

File metadata and controls

23 lines (14 loc) · 1.18 KB
id title sidebar_label
architecture
Architecture
Architecture

Architecture Diagram

Four Cache Behaviours are created in CloudFront.

The first two _next/* and static/* forward the requests to S3.

The third is associated to a lambda function which is responsible for handling three types of requests.

  1. Server side rendered page. Any page that defines getInitialProps or getServerSideProps method will be rendered at this level and the response is returned immediately to the user.

  2. Statically optimised page. Requests to pages that were pre-compiled by next to HTML are forwarded to S3.

  3. Public resources. Requests to root level resources like /robots.txt, /favicon.ico, /manifest.json, etc. These are forwarded to S3.

The reason why 2. and 3. have to go through Lambda@Edge first is because the routes don't conform to a pattern like _next/* or static/*. Also, one cache behaviour per route is a bad idea because CloudFront only allows 25 per distribution.

The fourth cache behaviour handles next API requests api/*