cloudflare / Stout

A reliable static website deploy tool
MIT License
752 stars 29 forks source link

'create' command doesn't work well for SPAs #53

Closed assembledadam closed 6 years ago

assembledadam commented 6 years ago

The 'create' command creates an S3 bucket configured with static website hosting and a cloudfront distribution with a custom origin (rather than origin of type 'S3').

The issue for Single Page Applications (SPAs) that require all routes to redirect to index.html is that the setup respects the S3 static website hosting rules for managing 404s, not CloudFront (which would handle them properly), as I think the author intends. When S3 manages the 404s, it does work (it directs to index.html), but the response code is still 404, which is obviously wrong (and will mess with SEO).

I'm just working on tweaking my setup to turn off static website hosting on the bucket, and changing the distribution to an S3 origin, which I believe should remedy the problem, and begin respecting the custom error page handling on CloudFront.

assembledadam commented 6 years ago

Ok... was a pebkac issue.

Had my DNS setting pointing to the S3 bucket and not the CloudFront distribution.