How a request flows
- Client Request
A user’s browser or application sends an HTTP/HTTPS request:
- DNS Resolution to Nearest Edge
The client’s DNS resolver directs the request to the nearest CloudFront edge location based on routing policies and latency.
- Edge Cache Check
- If the requested object is already cached locally and not expired, CloudFront immediately serves it to the client.
- This results in low latency and no request to the origin.
- Forward to Origin (Cache Miss)
- If the object is not cached, CloudFront forwards the request to the configured origin:
- S3 bucket (private with OAC or public)
- HTTP server (EC2 instance, Load Balancer, on-prem server, or custom backend)
- Origin Response & Caching
- The origin sends the response back to CloudFront.
- CloudFront caches the object at the edge location based on:
- Cache-Control headers
- Default TTL / Min TTL / Max TTL configured in the distribution.
- Serve to Client
- The cached response is returned to the client.
- Future requests for the same object from nearby clients are served directly from the edge cache.