AWS · Advanced Networking Specialty

网络课程笔记

Lecture 166 · 11 张幻灯片

幻灯片、双语总结及 Transcript · 图片已内嵌,可离线阅读。

原文默认收起
lecture-166.md

Lecture 166: CloudFront Origin Headers

  • 课程:[NEW] AWS Certified Advanced Networking Specialty 2026
  • 视频时长:01:41
  • 来源:Udemy Lecture 28556139
  • Slide 数量:11
  • 画面切换:00:05、00:12、00:22、00:29、00:36、00:52、01:02、01:11、01:17、01:27

扫描说明

逐条读取了 Udemy 页面中的 50 条英文 Transcript cue,并按时间轴扫描全长约 01:42 的视频。按每 4 条 cue 截取 13 个候选画面;联系表复核后移除 2 个没有新增内容的完成态重复帧,最终保留 11 个自定义 Header、设备、位置、协议和 Policy 揭示阶段。所有图片均关闭 Transcript 侧栏并隐藏播放器控件,按 video 元素计算真实 16:9 媒体区域;成品无弹窗、黑边或右侧/下方裁切,统一为 1364×770。

Transcript 来自 Udemy 页面自带的英文自动字幕,没有使用 ASR。下面保留页面原文,包括其中的语法或识别错误。

1. Origin Custom Headers 概览

时间范围:00:00–00:05

CloudFront origin custom headers title slide

总结 / Summary

中文

CloudFront 支持源站自定义标头(Origin Custom Header),在 Viewer Request 到达 Origin 前加入额外键值。

English

CloudFront supports origin custom headers, adding extra key-value pairs before a viewer request reaches the origin.

Transcript

00:00 Okay.

00:01 So let's talk about origin headers for CloudFronts.

00:03 So you can have custom headers.

00:04 And what are those?

2. Viewer Request 进入 CloudFront

时间范围:00:05–00:12

Viewer request with standard headers entering CloudFront

总结 / Summary

中文

用户请求先携带 Host、User-Agent、Accept-Encoding 等标准 HTTP Header 进入 CloudFront。

English

The viewer request first enters CloudFront with standard HTTP headers such as Host, User-Agent, and Accept-Encoding.

Transcript

00:05 Well, if the user's passing a request to CloudFronts,

00:08 for example, this one,

00:09 which already has some headers,

00:10 it is possible for CloudFront

3. CloudFront 添加固定 Custom Header

时间范围:00:12–00:22

CloudFront adding a custom header before forwarding to the origin

总结 / Summary

中文

CloudFront 在转发前添加预配置的固定 Custom Header;不同 Origin 可以使用不同 Header 与 Value。

English

CloudFront adds a preconfigured fixed custom header before forwarding. Each origin can use a different header and value.

Transcript

00:12 to add a custom header to the request

00:14 before passing it on to the origin.

00:17 So the idea is that you can customize it for each origin

00:20 and you can set whatever header you want.

4. Custom 与 S3 Origins 都支持

时间范围:00:22–00:29

Origin custom header features for custom and S3 origins

总结 / Summary

中文

Origin Custom Header 支持自定义源站(Custom Origin)和 S3 Origin,并且数值由 Distribution 配置而非 Viewer 提供。

English

Origin custom headers work with both custom and S3 origins, and their values come from the distribution configuration rather than the viewer.

Transcript

00:22 These are fixed values,

00:23 this supports custom and S3 origins.

00:26 And the use cases for this is going to identify

00:28 which requests are coming

5. 识别特定 Distribution

时间范围:00:29–00:36

Using a custom header to identify CloudFront or a specific distribution

总结 / Summary

中文

源站(Origin)可检查 Custom Header,以识别请求来自 CloudFront 或某个特定 Distribution。

English

The origin can inspect the custom header to identify requests from CloudFront or from a particular distribution.

Transcript

00:29 from CloudFront

00:30 or from a particular distribution

00:32 on to your origin.

00:34 This is going to be also very helpful as we'll see,

6. Secret Header 控制 Origin Access

时间范围:00:36–00:52

Using a secret custom header to control direct origin access

总结 / Summary

中文

把 Custom Header 当作 Secret,可让 Origin 只响应带有正确值的请求,从而拒绝绕过 CloudFront 的直接访问。

English

Treating the custom header as a secret lets the origin respond only to requests carrying the correct value, blocking direct access that bypasses CloudFront.

Transcript

00:36 to control access to the contents.

00:38 For example,

00:39 to say that the origin can only respond to your request

00:41 when it actually originates from CloudFront,

00:44 with the correct custom header.

00:47 There's other headers that can be added back out front,

00:49 and these are more dynamics,

00:50 but there are specific HTTP headers

7. Viewer Device Type Headers

时间范围:00:52–01:02

CloudFront viewer device type headers based on User-Agent

总结 / Summary

中文

CloudFront 可依据 User-Agent 添加 Viewer Device Type Header,例如 Android、Desktop、iOS、Mobile、SmartTV 和 Tablet。

English

CloudFront can add viewer device-type headers from User-Agent, including Android, Desktop, iOS, Mobile, SmartTV, and Tablet indicators.

Transcript

00:52 based on the viewer request.

00:54 So we can have a look at the viewers type of device

00:58 based on the user agents.

00:59 So it could be CloudFront is Android,

8. Viewer Location Headers

时间范围:01:02–01:11

CloudFront viewer location headers based on IP address

总结 / Summary

中文

Viewer Location Header 根据客户端 IP Address 派生,可提供 City、Country、Latitude、Longitude 等地理信息。

English

Viewer location headers are derived from the client IP address and can provide city, country, latitude, longitude, and related geography.

Transcript

01:02 Desktop, iOS, mobile, smart TV, Tablet, Viewer.

01:05 We can get information about the location headers

01:07 based on the IP address,

01:08 so we can get CloudFront Viewer, City, Country,

9. Viewer Request Protocol Headers

时间范围:01:11–01:17

CloudFront viewer request protocol and HTTP version headers

总结 / Summary

中文

Protocol Header 描述 Viewer 使用的传输协议与 HTTP Version,为后续缓存或 Origin Logic 提供上下文。

English

Protocol headers describe the viewer's transport protocol and HTTP version, providing context for caching or origin logic.

Transcript

01:11 Latitude, Longitude and so on.

01:13 And then we can get information around the protocol

01:15 and the HTTP version.

01:16 For example,

10. Forwarded-Proto 与 HTTP-Version

时间范围:01:17–01:27

CloudFront Forwarded Proto and Viewer HTTP Version headers

总结 / Summary

中文

典型字段包括 CloudFront-Forwarded-Proto 和 CloudFront-Viewer-Http-Version,可区分 HTTP/HTTPS 及 Viewer 的协议版本。

English

Typical fields include CloudFront-Forwarded-Proto and CloudFront-Viewer-Http-Version, distinguishing HTTP from HTTPS and the viewer's protocol version.

Transcript

01:17 we can get the CloudFront Forwarded Proto

01:19 and the CloudFront Viewer HTTP version.

01:22 And all of these headers can be helpful if you want to,

01:25 to cache based on them.

11. Cache Key 与 Origin Request Policy

时间范围:01:27–01:41

Using CloudFront headers in cache keys and origin request policies

总结 / Summary

中文

这些 Header 可通过 Cache Policy 纳入缓存键(Cache Key),生成不同缓存变体;也可通过源站请求策略(Origin Request Policy)转发到 Origin。

English

These headers can be included in the cache key through a cache policy to create separate variants, or forwarded to the origin through an origin request policy.

Transcript

01:27 Okay. So we can use them in your Cache key or at,

01:30 or choose to receive them directly on your origin.

01:34 So that's it for this lecture.

01:35 We'll see how to use these custom headers

01:38 in one of the following hands on.

01:39 So I will see you in the next lecture.

整讲总结 / Overall Summary

中文

CloudFront 可以在把 Viewer Request 转发给源站(Origin)前添加自定义源站标头(Origin Custom Header)。该值按 Origin 配置且固定,Custom Origin 与 S3 Origin 均支持。源站可据此识别请求是否来自特定 CloudFront Distribution,或只在存在正确 Secret Header 时返回内容,从而阻止绕过 CloudFront 的直接访问。CloudFront 还可根据 Viewer Request 动态添加 HTTP Header:设备类型(Device Type)来自 User-Agent,位置标头(Location Header)来自 Viewer IP,可包含 City、Country、Latitude、Longitude;协议标头(Protocol Header)包括 CloudFront-Forwarded-Proto 和 CloudFront-Viewer-Http-Version。这些 Header 可以纳入缓存键(Cache Key)以区分缓存变体,或通过源站请求策略(Origin Request Policy)转发给 Origin。

English

CloudFront can add an origin custom header before forwarding a viewer request to an origin. The fixed value is configured per origin and works with both custom and S3 origins. An origin can use it to identify requests from a particular CloudFront distribution or respond only when the correct secret header is present, preventing direct access that bypasses CloudFront. CloudFront can also add dynamic HTTP headers based on the viewer request. Device-type headers come from User-Agent, location headers come from the viewer IP and can include city, country, latitude, and longitude, and protocol headers include CloudFront-Forwarded-Proto and CloudFront-Viewer-Http-Version. These headers can participate in the cache key or be forwarded to the origin through an origin request policy.

返回顶部 ↑