Tag: CloudFront

Dynamic Origin Swapping in AWS CloudFront with Lambda@Edge

I recently needed to add a staging environment to my single page apps (SPA) hosted on S3 and served through an existing CloudFront distribution. My bucket layout looked like this: Rather than stand up a second distribution, I decided to serve stage traffic from the same CF endpoint—simply by swapping the S3 origin path at runtime. The natural […]