简体   繁体   English

AWS S3 存储桶 - 子页面上的访问被拒绝

[英]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.

相关问题 来自 URL referer 的 AWS S3 Bucket 策略/访问 - 访问被拒绝 - AWS S3 Bucket policy/access from URL referer - access denied 使用 force_delete=true 创建的 AWS S3 存储桶无法通过 terraform 拒绝访问删除 - AWS S3 Bucket created with force_delete=true fails to delete with Access Denied via terraform Android AWS S3 访问被拒绝 - 将纯文本上传到 Android 上的存储桶 - Android AWS S3 Access Denied - Uploading plain text to Bucket on Android AWS S3 存储桶访问文件权限 - AWS S3 Bucket Access file permission Cloudfront 在没有公共访问的情况下为 S3 存储桶源提供通过 AWS CDK Python 创建的访问被拒绝的响应 - Cloudfront give Access denied response created through AWS CDK Python for S3 bucket origin without public Access AWS Lambda S3 访问被拒绝 - AWS Lambda S3 Access Denied 尝试从 AWS Lambda 访问 S3 时访问被拒绝 - Access Denied when trying to access S3 from AWS Lambda 对 AWS S3 存储桶的有限访问:Wordpress 链接 - Limited access to AWS S3 bucket: Wordpress links 用户明智地限制访问 s3 存储桶媒体 URL (AWS) - User wise restricted access of s3 bucket media URL (AWS) 如何限制对 AWS s3 存储桶的所有访问 - How to restrict all access to the AWS s3 bucket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM