简体   繁体   English

在 AWS Amplify 上部署 React Web 应用程序时出现 403 ACCESS DENIED 错误

[英]Getting 403 ACCESS DENIED error when deploying React Web app on AWS Amplify

Been racking my brain on this for a couple of days.这几天一直在绞尽脑汁。 I am trying to deploy my react app on AWS Amplify.我正在尝试在 AWS Amplify 上部署我的 React 应用程序。 When I launch the application I am correctly directed to a sign in page (Uses Auth0 Universal login) After logging in I am redirected back to my web app through the callback URL.当我启动应用程序时,我被正确定向到登录页面(使用 Auth0 通用登录)登录后,我通过回调 URL 重定向回我的网络应用程序。

When my page loads I get the following message当我的页面加载时,我收到以下消息

This XML file does not appear to have any style information associated with it.此 XML 文件似乎没有任何与之关联的样式信息。 The document tree is shown below.文档树如下所示。

<Error>
<Code>AccessDenied</Code>

<Message>Access Denied</Message>

<RequestId>B2173BDEE0658858</RequestId>

<HostId>
TRevHdaqGZYTUxU9W1wXc3CQccfLeznHlYLcbuF+Wr511FVmOPFBp4tpyccJ2t5QMVpvYygNNb4=
</HostId>
</Error>

I am not hosting the web app through an s3 bucket, I uploaded my build file directly to AWS Amplify.我没有通过 s3 存储桶托管 Web 应用程序,而是将我的构建文件直接上传到 AWS Amplify。

Any ideas on what the issue is?关于问题是什么的任何想法?

在此处输入图片说明

在此处输入图片说明

Use this rule on amplify console.
[
    {
        "source": "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>",
        "target": "/index.html",
        "status": "200",
        "condition": null
    }
]

When you create the zip folder, make sure you zip the contents of your build output and not the top level folder.创建 zip 文件夹时,请确保压缩构建输出的内容,而不是顶级文件夹。 For example, if your build output generates a folder named “build” or “public”, first navigate into that folder, select all of the contents, and zip it from there.例如,如果您的构建输出生成一个名为“build”或“public”的文件夹,首先导航到该文件夹​​,选择所有内容,然后从那里压缩它。 If you do not do this, you will see an “Access Denied” error because the site's root directory will not be initialized properly.如果不这样做,您将看到“拒绝访问”错误,因为站点的根目录将无法正确初始化。

  <Error>
      <Code>AccessDenied</Code>
      <Message>Access Denied</Message>
      <RequestId>4442587FB7D0A2F9</RequestId>
      <HostId>...</HostId>
 </Error>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我在 AWS Amplify 上重新加载我的 React 应用程序时出现“访问被拒绝”错误 - Getting an "Access Denied" error when I reload my React app on AWS Amplify 在 AWS S3 和 CloudFront 中托管 React 路由器应用程序时出现 403 Access Denied 错误 - Getting 403 Access Denied Errors When Hosting a React Router App in AWS S3 and CloudFront AWS Amplify 自定义域给出 403 拒绝访问错误 - AWS Amplify custom domain giving 403 access denied Error React App 保护的路由抛出访问被拒绝错误 - 托管在 AWS Amplify 上 - React App protected routes throw Access denied error - hosted on AWS Amplify 来自 AWS Amplify 上托管的反应应用程序的受保护路由的访问被拒绝错误 - Access Denied Error from protected routes from react app hosted on AWS Amplify AWS 放大 REST API Lambda Function 403 {“消息”:“拒绝访问”} - AWS Amplify REST API Lambda Function 403 {"message":"Access Denied"} 将 React 应用程序部署到 aws amplify 后,react.production.min.js 发生错误 - Error occured in react.production.min.js after deploying react app to the aws amplify 从 React Amplify APP 访问 AWS Secret - Access AWS Secrets from React Amplify APP 使用 Basic React App 时无法在 AWS Amplify 中使用图像 - Cannot use images in AWS Amplify when using Basic React App 将React App部署到AWS - Deploying a React App to AWS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM