使用 aws s3 和 cloudfront 托管 React application.Can 有人建议配置以访问动态 url 吗?
Using aws s3 and cloudfront to host React application.Can anyone suggest configuration to access dynamic urls?
例如网站 url 是 https://www.myreactapp.com。它有一些其他带有动态获取参数的页面。
https://www.myreactapp.com/category/1
https://www.myreactapp.com/category/2
提示访问被拒绝错误
OP 的解决方案是将来源从 S3 更新到自定义来源域。这允许预期的行为起作用。
已验证存储桶是 public,错误 403 是由密钥不存在引起的。
我在尝试使用 ajax.
在 运行 时间访问内容时遇到了同样的问题
设置S3 bucket访问为“Objects can be public”,静态网站托管无需设置“Public”访问。
如果您希望 CloudFront 传送放置在 S3 存储桶中的任何对象,请使用 S3 Origin。但是如果你生成运行时间内容,就可以使用Custom Origin.
对于自定义来源 保留注释:https://docs.aws.amazon.com/general/latest/gr/s3.html#s3_website_region_endpoints
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistS3AndCustomOrigins.html
例如网站 url 是 https://www.myreactapp.com。它有一些其他带有动态获取参数的页面。
https://www.myreactapp.com/category/1
https://www.myreactapp.com/category/2
提示访问被拒绝错误
OP 的解决方案是将来源从 S3 更新到自定义来源域。这允许预期的行为起作用。
已验证存储桶是 public,错误 403 是由密钥不存在引起的。
我在尝试使用 ajax.
在 运行 时间访问内容时遇到了同样的问题设置S3 bucket访问为“Objects can be public”,静态网站托管无需设置“Public”访问。
如果您希望 CloudFront 传送放置在 S3 存储桶中的任何对象,请使用 S3 Origin。但是如果你生成运行时间内容,就可以使用Custom Origin.
对于自定义来源 保留注释:https://docs.aws.amazon.com/general/latest/gr/s3.html#s3_website_region_endpoints https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistS3AndCustomOrigins.html