Why doesn't react's BrowserRouter work on cloudfront when s3 oai settings are applied?

0

BrowserRouter was used to implement the react webpage spa in s3.

When I set it to public, it worked fine. However, when accessing from cloudfront after applying public access deny and oai, it did not work. So I used HashRouter and it worked.

My guess is that s3 only supports static webpages, so browserRouter doesn't work, only HashRouter works. However, when set to public, BrowserRouter worked.

If I apply the oai setting to s3, why doesn't react's BrowserRouter work on cloudfront?

joker
已提问 2 年前216 查看次数
1 回答
0

This Stackoverflow link might be addressing this issue https://stackoverflow.com/questions/51218979/react-router-doesnt-work-in-aws-s3-bucket For steps about how to use BrowserRouter with S3 and CloudFront, refer to this external link https://aws.plainenglish.io/how-to-deploy-react-app-with-s3-and-cloudfront-6d170172cd58

AWS
已回答 2 年前
  • This is a temporary measure to fix the error, so I don't think it's a fundamental solution. And I asked why the browser router is not working.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则