使用 s3_website gem 在 S3 托管上使用 React 应用程序的中断路由
Broken routes with react app on S3 hosting using s3_website gem
我正在使用 S3_website gem 将 React 构建推送到我的存储桶。一切正常,但是当我导航到自定义 url 并点击刷新时,出现 404 错误,因为它试图在存储桶中查找该对象而不是执行路由。
我在 s3_website yml 中有默认配置,没有重定向规则。
site: dist
index_document: index.html
error_document: error.html
s3_endpoint: us-east-2
cloudfront_wildcard_invalidation: true
我缺少什么配置?
在 Error Document
下的存储桶属性中,只需使用与 Index Document
相同的文件,这应该是您的 index.html
我正在使用 S3_website gem 将 React 构建推送到我的存储桶。一切正常,但是当我导航到自定义 url 并点击刷新时,出现 404 错误,因为它试图在存储桶中查找该对象而不是执行路由。
我在 s3_website yml 中有默认配置,没有重定向规则。
site: dist
index_document: index.html
error_document: error.html
s3_endpoint: us-east-2
cloudfront_wildcard_invalidation: true
我缺少什么配置?
在 Error Document
下的存储桶属性中,只需使用与 Index Document
相同的文件,这应该是您的 index.html