Amazon CloudFront
Put a distribution in front of an S3 bucket or your local API and open it at a local URL, to test a static site, a single-page app or path-based routing before deploying.
Features
Distributions
- List distributions with status, description, local URL, origins and last modified date; find by ID, description or origin
- Create distribution for a bucket: default root object, Single-page app (serves the root object with 200 for 403 and 404), description
- Enable, Disable and Delete (only disabled distributions can be deleted)
- Stack: X link to CloudFormation when the distribution was created by a stack
General
- Details: distribution ID, ARN, AWS domain name, last modified
- Connect card: the local URL with Open, plus Node.js and Python samples that create an invalidation (the last step of a deploy script)
- Edit settings: description, default root object, single-page app
- Error pages table: HTTP error code, response page path, response code
Origins
- List origins with type, bucket or address, and origin path; buckets link to S3
- Create origin, Edit, Delete: S3 bucket in Floci or custom origin (domain, protocol, port), optional origin path
- An origin still used by a behavior can't be deleted
Behaviors
- List behaviors in precedence order with path pattern, origin and cache, origin request and response headers policies
- Create behavior (path pattern, origin), Edit, Delete, Move up / Move down; the default behavior stays last
Invalidations
- Create invalidation with one path per line
- List invalidations with status and creation time
Typical workflow
- Upload your built site to a bucket in S3.
- On Distributions, choose Create distribution, pick the bucket, and turn on Single-page app if your app uses client-side routes.
- Open the Local URL from the list or the General tab.
- To route
/api/*to your app, add a custom origin on the Origins tab, then a behavior for/api/*on the Behaviors tab.
Works with
- Amazon S3: buckets are origins; a bucket's Properties tab lists the distributions serving it, with Create distribution
- AWS CloudFormation: distributions created by a stack link to it
Limitations
- Floci serves distributions for real but never caches: invalidations complete at once, cache policies have no effect, and Floci reports every distribution as deployed, so the list shows only Enabled / Disabled.
- Floci doesn't run CloudFront Functions or Lambda@Edge attached to behaviors.
- Floci returns only the
*.cloudfront.netdomain; use the local URL (*.cloudfront.localhost.floci.io) instead. It needs public DNS, so it doesn't work offline, and containers in the compose can't resolve it. - A custom origin on your machine (
host.docker.internal) answers 502 until Floci starts withFLOCI_SERVICES_CLOUDFRONT_ALLOWED_PRIVATE_ORIGIN_HOSTS=host.docker.internal(Configuration). - An S3 website endpoint used as a custom origin is fetched from real AWS; choose S3 bucket for buckets in Floci.
- Floci accepts settings AWS rejects (duplicate origin IDs or path patterns, behaviors pointing at a missing origin); the console blocks them.