AWS S3上的Angular应用程序可以通过CloudFront解决除了索引路线以外的另一条路线吗?

发布于 2025-02-09 19:43:00 字数 247 浏览 1 评论 0原文

我有一个在S3上托管的Angular应用程序。当我尝试直接进入myApp.com/items的路线时,我会遇到403禁止错误。但是,当我从myApp.com访问应用程序时,一切都还好,从应用程序可以导航到myApp.com/items。我不明白为什么会发生这种情况。

我该如何做到这一点,以便可以直接访问myApp.com/items之类的路线?

I have an angular app hosted on S3. When I try to directly go to a route like myapp.com/items I get a 403 forbidden error. But when I access the app from myapp.com everything is okay and from the app I can navigate to myapp.com/items. I don't understand why this is happening.

How can I make it so that routes like myapp.com/items can be accessed directly and not throw an error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

带上头具痛哭 2025-02-16 19:43:00

在CloudFront分发上输入错误页面选项卡

”在此处输入图像描述”

然后创建一个新的错误响应以处理任何OTHE路由,然后将其重定向到index.html文件

On CloudFront distribution enter error pages tab

enter image description here

Then create a new error response to deal with any othe routes and redirect it to index.html file

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文