我有一个包含任意命名文件的存储桶和一个生成 2 天后过期的签名 URL 的 ruby 脚本,但我需要添加一个内容处置 header 以将文件名更正为所需格式。
任意(使用数据库中的主键)以防止文件名冲突
是否可以更改 URL 以使其添加内容配置 header 而不修改文件 content-disposition
header 并将其保存在存储桶中?
最佳答案
如果你使用实例方法url_for()类AWS::S3::S3Object来自 AWS SDK for Ruby为您的 Amazon S3 生成预签名 URL对象,可选的 options
哈希允许您指定用于生成 URL 的其他选项,其中包括所需的 content-disposition
header :
:response_content_disposition (String) — Sets the Content-Disposition header of the response when performing an HTTP GET on the returned URL.
关于ruby-on-rails - 带有自定义 header 的 S3 临时签名 url,无需将对象元数据修改到磁盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10397147/