[英]AWS S3 Bucket - Access Denied on Sub-Pages
So I have an AWS S3 Bucket hosting the files for a react application I've built.所以我有一个 AWS S3 Bucket 来托管我构建的 React 应用程序的文件。 I use CodePipeline to build and compile the React app and store the files on an S3 bucket which is served through a CloudFront CDN.
我使用 CodePipeline 构建和编译 React 应用程序,并将文件存储在通过 CloudFront CDN 提供的 S3 存储桶中。
Everything seems to be working fine when I access the url from the root https://website.com
.当我从根
https://website.com
访问 url 时,一切似乎都运行良好。 When I click "login" on that page I get directed to the following route https://website.com/auth/login
and it works awesome.当我单击该页面上的“登录”时,我被定向到以下路线
https://website.com/auth/login
并且效果非常好。
The Problem If I try to access the page https://website.com/auth/login
directly I get the following error:问题如果我尝试直接访问页面
https://website.com/auth/login
,我会收到以下错误:
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>66CE67E2E5DA0B7B</RequestId>
<HostId>Spfhgnlygx05eugycEy5ew4e8oSn/ccNX21Iy/6qaAxI8glXljDjgKmUPvMzRd8+NktQsNietpg=</HostId>
</Error>
I set the default resource in the cloudfront CDN to the /index.html
which is why the root domain works, but how do I get all there urls to point to /index.html
so the app routes it properly?我将 cloudfront CDN 中的默认资源设置为
/index.html
,这就是根域工作的原因,但我如何让所有 url 指向/index.html
,以便应用程序正确路由它?
I needed to set a rule for 403 Forbidden in my cloudfront configuration as posted here: Receive AccessDenied when trying to access a reload or refresh or one in new tab in angular 5我需要在我的云端配置中设置 403 Forbidden 规则,如下所示:在 angular 中尝试访问重新加载或刷新或新选项卡中的一个时接收 AccessDenied 5
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.