Configure Amazon S3 static site with Angular JS ui.router html5Mode(true) on page refresh

前端 未结 4 1300
栀梦
栀梦 2020-12-10 04:04

How can I configure an Amazon S3 static webpage to properly route Angular ui.router html5Mode routes? On page refresh, it will make a request for a file that doesn\'t exist,

4条回答
  •  情书的邮戳
    2020-12-10 04:38

    Make sure you have the index route configured for your website. Mostly it is index.html Remove routing rules from S3 configurations Put a Cloudfront in front of your S3 bucket. Configure error page rules for your Cloudfront instance.

    In the error rules specify:

    Http error code: 404 (and 403 or other errors as per need)
    Error Caching Minimum TTL (seconds) : 0
    Customize response: Yes
    Response Page Path : /index.html
    HTTP Response Code: 200
    

提交回复
热议问题