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/