When building a React SPA with Cloudflare as the CDN it is possible to use S3 for static asset storage. If you have all of your resources typically on AWS, but want some of the advantages of Cloudflare, you can build a system that is very similar to the traditional Cloudfront + S3 architecture. There are a few differences in deployments and setup, but it is generally the same. The typical approach with Cloudflare uses S3 static website hosting with IP restrictions, but this comes with significant limitations: the static website endpoint only supports HTTP (not HTTPS), and working around this requires disabling SSL enforcement on your bucket.

There's a cleaner pattern that avoids these issues entirely. Instead of enabling S3 static website hosting, you can use a Cloudflare Worker to fetch assets directly from S3's dualstack endpoint. The Worker handles SPA routing that would normally require S3's static website features, while the dualstack endpoint provides HTTPS and IPv6 support. This post walks through implementing this pattern with AWS CDK and Cloudflare Workers.