SPA - Cloudfront + S3 403/404 error

AWS/Amazon CloudFront

  • outline

SPA architecture using route53, CloudFront(CNAME) and S3 can occurs 403 error when direct access to sub-path. For normal root routing, 403 or 404 are needed to be redirected to 200 and /index.html.

  • how-to
  1. CloudFront

  2. Distributions

  3. Error Pages

  4. Create custom error reponse

  5. HTTP error code 403 // HTTP error code 404

  6. Customize error reponse

  7. Yes

  8. Response page path : /index.html

  9. HTTP Reponse code : 200

  10. Invalidation /*