- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
There appears to be a contradiction in the AWS documentation regarding changing from a custom origin to an Amazon S3 origin using Lambda@Edge.
The error you're encountering is consistent with the statement in the Lambda@Edge event structure documentation that says "You can't use an OAI when you change the request from a custom origin to an Amazon S3 origin." This restriction means that the example code provided in the documentation that uses 'authMethod': 'origin-access-identity' would not work in this specific scenario.
To resolve this issue, you should modify the example code to use 'authMethod': 'none' instead when changing from a custom origin to an S3 origin. The documentation states that if you're not using an Origin Access Identity (OAI), you should set the authMethod field to 'none'.
Additionally, if you're working with S3 origins, you might want to consider using Origin Access Control (OAC) instead of OAI, as OAC is the recommended approach according to AWS. If using OAC, you would specify an empty OriginAccessIdentity element.
Lambda@Edge is particularly useful for this type of dynamic origin selection, especially when you have highly cacheable content or when your origin update logic requires fetching data from third-party sources.
Sources
Lambda@Edge example functions - Amazon CloudFront
S3OriginConfig - Amazon CloudFront
Lambda@Edge event structure - Amazon CloudFront
Helper methods for origin modification - Amazon CloudFront
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor 3 Monaten
