AWS

You shouldn't use Amazon CloudFront distribution as an origin

CK CK 3788 
Created at  
631 0 0

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:

  • Amazon S3
  • Amazon EC2 / Elastic Load Balancer (ELB)
  • AWS MediaPackage
  • Custom HTTP servers (e.g., an on-premises web server)

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 Alternatives

If you're considering doing this for performance or architecture reasons, here are some valid options:

1. Use an S3 Bucket with Static Redirects

If 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 Function

You 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 CloudFront

If the first distribution is fronting a service or app, you can set its custom domain (e.g., cdn.example.com) as the origin for the second CloudFront distribution. This works only if the first distribution properly handles the Host header and CORS, if applicable.

 

Caveats

  • Increased latency: Going through multiple CDNs increases latency and complexity.
  • Header forwarding: Some headers (like Host) must be carefully handled to avoid issues.
  • Cache behavior: CDN-to-CDN chaining can interfere with cache control headers, invalidations, or TTLs.

 

Conclusion

CloudFront 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.

Tags GitHub RSA RSA Keys SSH Keys Facebook X
Comments 0
Similar posts
  1. How to use multiple RSA (SSH) keys for GitHub
    321
  2. Contributing to the Ethereum Foundation
    3,504
  1. Architectural Diagram Gallery for Amazon MSK
    497
  2. Architectural Diagram Gallary for Amazon Kinesis
    517
  3. Real-time Data Streaming Solutions - Kafka vs. Kinesis Comparison
    847
  4. Building a Video Content Recommendation System with Amazon SageMaker
    521
  5. The Immense Scale and Management of Exabyte Data with AWS
    504
  6. How to change your AWS Credential Region in CLI?
    749
  7. Default Timeout for Amazon Bedrock invoke_model
    732
  8. When you face 504 Timeout Errors by Amazon ALB
    1,466
  9. When you face 504 Gateway Timeout while you wait a response from Bedrock in Fast API
    532
  10. How to overcome the prompt size limit when you use Claude via Bedrock - Chunking / Splitting the Input
    494
  11. Integrating VectorDB stored in S3 with Amazon Bedrock
    421
  12. When you need AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY for Amazon Bedrock
    532
  13. How Netflix Runs Recommendations for Hundreds of Millions of Users Using Amazon SageMaker & Metaflow
    171
  14. Why Amazon VPC satisfies with PCI-DSS and SOC 2 Type on Fintech Industry?
    641
  15. Amagi CLOUDPORT Architecture based on AWS for FAST for channel playout on AWS
    1,315
  16. Creating a serverless Apache Kafka publisher using AWS Lambda
    562
  17. AWS System Design Example - Instagram Architecture
    1,916
  18. A Python script to create an EC2 Spot instance using boto3
    1,598
  19. A Python/PHP code to deregister anormalous instaces in Amazon ECS
    1,855
  20. Where to get AWS API Key at AWS Management Console?
    1,062
  21. Understanding Amazon Bedrock Agent for AI-based ChatBot
    642
  22. Media sharing service architecture in AWS
    10,364
  23. Enterprise Data Lake Architecture based on AWS
    10,403
  24. "502 Bad Gateway" Error easy to happen at the combination of nginx and node.js in AWS Elastic Beanstalk
    10,485
  25. How to Set Up and Deploy Containerized Applications with AWS ECS
    10,672
  26. Power of Containerized Deployment with AWS ECS
    10,594
  27. FAISS Already Does ANN... So Why Do Top Teams Still Pay for SageMaker?
    307
  28. Recommended Vector DB Structure for Amazon Bedrock Integration
    388
  29. Product Marketing & Recommendation Architecture in AWS for e-commerce website
    10,733
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    27
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    24
  3. How do I create animated background for Google Meet?
    19,720
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    217
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    85
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    153
  7. Array of arguments passed to script in PHP
    85
  8. Invalid Auction Storms in Ad Tech
    93
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    198
  10. The Two Clocks of Ad Server Architecture
    63
  11. Frequency Cap Architecture Overview
    509
  12. Collecting Proof-of-Play from 100,000 Screens
    141
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    280
  14. What is RedisVL?
    105
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    224
  16. TPU & GPU Cluster Management Tools
    232
  17. The Concept of Scaffolding in AI Agents
    221
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    576
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    253
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    328
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    197
  22. Machine Learning: Training vs. Ranking
    213
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    217
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    189
  25. Designing a Data Curation System Around a Vector Database
    215
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    229
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    649
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    185
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    207
  30. Understanding Data Lineage
    252