S3 上的 Angular,刷新导致“AccessDenied”响应

jpm*_*yob 2 amazon-s3 amazon-cloudfront angular

我有一个 angular 5 应用程序 - 我一直在本地运行,让它在 heroku 上运行一个 nodjs 服务器很好,但是当我把它放在一个 S3 存储桶中时,在 cloudfront 后面,我点击刷新我得到了这个。

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>217...1C</RequestId>
<HostId>
yu2de...dr0=
</HostId>
</Error>
Run Code Online (Sandbox Code Playgroud)

有什么建议?

use*_*994 10

您需要配置 Cloudfront 来处理路由,以便所有路由都被重定向到 index.html

看看这个了解更多信息