laurilehmijoki / s3_website

Manage an S3 website: sync, deliver via CloudFront, benefit from advanced S3 website features.
Other
2.24k stars 187 forks source link

Support for Cloudfront custom error responses? #245

Closed tannerlinsley closed 7 years ago

tannerlinsley commented 8 years ago

This would be crucial for hosting our static single-page app on s3 as described here: https://kkob.us/2015/11/24/hosting-a-single-page-app-on-s3-with-proper-urls/, unless.... there is a better way you know of to properly reroute all paths to index.html :)

dancoates commented 8 years ago

I've run into this same issue as well as finding some other newish cloudfront features that I'd like to use like setting Origins[].OriginPath to serve from subdirectories. I think that supporting this would involve updating to use a newer version of the cloudfront api. The API used in configure-s3-website seems to be currently locked down to 2012-07-01 which is fairly out of date. I'm not sure what would be involved in updating.

laurilehmijoki commented 8 years ago

See https://github.com/laurilehmijoki/configure-s3-website/issues/16#issuecomment-264074020

laurilehmijoki commented 7 years ago

You can now use the latest CloudFront features in the cloudfront_distribution_setting if you upgrade to version 3.0.0. See https://github.com/laurilehmijoki/s3_website/blob/master/changelog.md#300 for more info.

Please reopen this issue if needed.

dancoates commented 7 years ago

@tannerlinsley an example of using s3_website version 3.0.0 config to reroute all paths to index.html is:

cloudfront_distribution_config:
  custom_error_responses:
    quantity: 1
    items:
      - error_caching_min_ttl: 60
        error_code: "404"
        response_code: "200"
        response_page_path: /index.html