- Newest
- Most votes
- Most comments
You need to explicitly include CloudFront request headers in specific behaviors to access them in your edge compute functions. This is done through either a cache policy or an origin request policy. You might access viewer's device type, location and more through:
-
Cache Policy: Use this if you want the header to be part of the cache key, influencing how CloudFront caches your content. The headers included in your cache policy will also be available to your edge functions.
-
Origin Request Policy: This allows you to use the headers for logic within your functions without affecting caching behavior. The headers will be included in the request to your origin (e.g., your web server or application) and also available to your edge functions.
Keep in mind that headers that you include in the cache key (using a cache policy) are automatically included in origin requests. Use the origin request policy to specify the information that you want to include in origin requests, but not include in the cache key. For more information, please see How origin request policies and cache policies work together in Amazon CloudFront Developer Guide.
Relevant content
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 3 months ago
