博客园  :: 首页  :: 管理

本文主要讲述Cloudfront的工作流程、如何将用户请求的数据-资源-对象,返回给用户

本文描述的是没有使用 【区域边缘缓存】的情况,目前为止,AWS中国区的cloudfront本来也就没有使用区域边缘

在aws的官方文档中有提到Cloudfront在没有使用区域边缘的情况,如何将用户请求返回,可以参考如下URL:

How CloudFront delivers content - Amazon CloudFront (amazonaws.cn)

After you configure CloudFront to deliver your content, here’s what happens when users request your objects:

1. A user accesses your website or application and sends a request for an object, such as an image file or an HTML file.

2. DNS routes the request to the CloudFront POP (edge location) that can best serve the request—typically the nearest CloudFront POP in terms of latency—and routes the request to that edge location.

3. CloudFront checks its cache for the requested object. If the object is in the cache, CloudFront returns it to the user. If the object is not in the cache, CloudFront does the following:

(a). CloudFront compares the request with the specifications in your distribution and forwards the request to your origin server for the corresponding objectfor example, to your Amazon S3 bucket or your HTTP server.

(b). The origin server sends the object back to the edge location.

(c). As soon as the first byte arrives from the origin, CloudFront begins to forward the object to the user. CloudFront also adds the object to the cache for the next time someone requests it.

整个过程可以用下图简单的说明: