Dan*_*ark 6 amazon-s3 reactjs react-router
我有一个由 Cloudfront/S3 支持的 React 单页应用程序 (SPA)。我有一个 S3 存储桶/welcome/并将客户端重定向到/welcome/new. 我在这两种情况下保留查询参数时都遇到问题(这是一个要求)。以下是我希望如何路由请求:
/welcome?test=true->/welcome/new/?test=true
/welcome/?test=true->/welcome/new/?test=true
第一个请求有问题。因为welcome是S3目录,S3 302的/welcometo /welcome/,我丢失了查询参数。
来自AWS文档:
However, if you exclude the trailing slash from the preceding URL, Amazon S3 first looks for an object photos in the bucket. If the photos object is not found, then it searches for an index document, photos/index.html. If that document is found, Amazon S3 returns a 302 Found message and points to the photos/ key. For subsequent requests to photos/, Amazon S3 returns photos/index.html. If the index document is not found, Amazon S3 returns an error.
我想到的一种解决方案是运行 Lambda@Edge 代码,并将对 Cloudfront 的请求重定向,并在两种情况下保留查询参数。这是一个好方法吗?我担心任何问题,因为我正在更改默认的 S3 路由行为。
| 归档时间: |
|
| 查看次数: |
1828 次 |
| 最近记录: |