Lambda@Edge Adds S3 Origin Support for Customizing Content Delivery based on Request Headers

Posted on: Mar 20, 2018

Starting today, Lambda@Edge enables you to further customize the delivery of content stored in an Amazon S3 bucket, by allowing you to access additional whitelisted headers, including custom headers, within origin-facing events. For example, you can configure Amazon CloudFront to cache and forward a country header to your S3 origin, and then use Lambda@Edge to dynamically redirect viewers to country-specific versions of your website, based on the viewer’s location. CloudFront also caches the responses to further improve the performance on subsequent requests to your website.

Until now, you could configure Amazon CloudFront with an S3 origin to forward and to cache objects based on only three headers: Access-Control-Request-Headers, Access-Control-Request-Method, and Origin. This limited the ability to leverage the full potential of Lambda@Edge, as you could only use cookies and query strings when you wanted to customize the delivery of content stored in S3 buckets. However, with this launch, you can now configure CloudFront with an S3 origin to cache and forward several additional headers, such as CloudFront-Viewer-Country or CloudFront-Is-*-Viewer, and then use Lambda@Edge to customize content based on these headers and deliver at low latencies to your viewers. To see all the supported headers, click here.

There is no additional fee for the new capability. To learn more about Lambda@Edge, visit the product page. For more information on how to use this new feature, see the following resources: