You shouldn't use Amazon CloudFront distribution as an origin | ||
| ||
| You cannot use an Amazon CloudFront distribution as an origin for another CloudFront distribution directly. CloudFront is primarily a content delivery network (CDN), and it's designed to pull content from an origin such as:
Using one CloudFront distribution as the origin of another creates a loop or unnecessary complexity, which AWS does not recommend or support directly. Workarounds or AlternativesIf you're considering doing this for performance or architecture reasons, here are some valid options: 1. Use an S3 Bucket with Static RedirectsIf your first CloudFront distribution serves S3-hosted content, you can have another bucket with redirect rules and set that as the origin of the second distribution. 2. Use a Lambda@Edge FunctionYou can route or rewrite requests dynamically at the edge using Lambda@Edge, which might simulate “chaining” behavior without directly setting one CloudFront distribution as another’s origin. 3. Use a Custom Domain Pointing to the First CloudFrontIf the first distribution is fronting a service or app, you can set its custom domain (e.g.,
Caveats
ConclusionCloudFront should not be used directly as an origin. If you're trying to solve a specific architecture challenge (like multi-region failover, URL rewriting, or authentication routing), there might be a better alternative depending on your use case. Let me know if you'd like help designing that. | ||
| | ||
| |