amazon-web-services - aws s3 同步包括复制网站重定向

标签 amazon-web-services amazon-s3

aws s3 sync默认情况下似乎不会复制网站重定向元数据。

有这个选项:

--website-redirect (string) If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata.

但我正在寻找某种指令来获取同步,以将每个文件的重定向复制到同步目标。有什么办法可以做到吗?

最佳答案

aws s3 cp有相同的选项。我不确定同步将如何执行此操作,因为它是整个目录,cp 仅执行单个文件,除非您使用与特定文件而不是整个目录的同步。

看起来重定向只是注入(inject)到文件中的元数据,这就是 --website-redirect 所设置的。

The following Amazon S3 API actions support the x-amz-website-redirect-location header in the request. Amazon S3 stores the header value in the object metadata as x-amz-website-redirect-location. https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html

x-amz-website-redirect-location

If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata. For information about object metadata, see Object Key and Metadata.

In the following example, the request header sets the redirect to an object (anotherPage.html) in the same bucket:

x-amz-website-redirect-location: /anotherPage.html

In the following example, the request header sets the object redirect to another website:

x-amz-website-redirect-location: http://www.example.com/ For more information about website hosting in Amazon S3, see Hosting Websites on Amazon S3 and How to Configure Website Page Redirects in the Amazon Simple Storage Service Developer Guide.

Type: String

Default: None

Constraints: The value must be prefixed by, "/", "http://" or "https://". The length of the value is limited to 2 K.

https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html

关于amazon-web-services - aws s3 同步包括复制网站重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51090170/

相关文章:

java - aws s3上传优化,使用java sdk

amazon-web-services - 在 AWS Cloudwatch 上为 Lambda 启用 Paho MQTT 客户端日志

amazon-web-services - AWS Lambda : An error occurred (403) when calling the HeadObject operation: Forbidden

amazon-web-services - 美国东部(弗吉尼亚北部)的 Elastic Beanstalk 中 AWS 上的 ipv6 支持

amazon-web-services - 在整个 s3 存储桶上回滚版本

ios - ios swift 中的亚马逊 AWS 服务器端加密

amazon-web-services - .Net Core DynamodDB 使用 XUnit 进行单元测试

mysql - 将 .sql 文件导入 mySQL 没有效果

php - AWS RDS 的外键约束不起作用

elasticsearch - 如何在 Fluentd 中将日志发送到具有相同匹配标签的多个输出?