已更新 AWS SDK,现在获取预签名错误

已更新 AWS SDK,现在获取预签名错误

我刚刚升级到最新的 Java SDK,我的预签名 URL 不再起作用。

以前我用过

        generatePresignedUrlRequest.addRequestParameter(
                Headers.S3_CANNED_ACL,
                CannedAccessControlList.PublicRead.toString()
        );

但是现在generatePresignedUrlRequest返回此错误:

There were headers present in the request which were not signed:  x-amz-acl

如何签署 x-amz-acl 标头?

答案1

变成:

   generatePresignedUrlRequest.putCustomRequestHeader(Headers.S3_CANNED_ACL, CannedAccessControlList.PublicRead.toString());

相关内容