🟡

CloudFront – High-Level Flow

How a request flows

  1. Client Request
    1. A user’s browser or application sends an HTTP/HTTPS request:
  1. DNS Resolution to Nearest Edge
    1. The client’s DNS resolver directs the request to the nearest CloudFront edge location based on routing policies and latency.
  1. 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.
  1. 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)
  1. 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.
  1. 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.