本文介绍了如何在节点js的预签名url请求中发送内容md5标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想检查上传到S3的对象的完整性.因此,我想包含md5标头,这样无论何时有人使用该URL,他们都应该仅上传有效内容.仅供参考:我将从用户界面中获取md5内容到我的服务.
I want to check the integrity of the object uploaded to S3.So I want to include the md5 header so whenever soomeone uses that url they should upload only the valid content.FYI: I would get the md5 content from the UI to my service.
const params = {
Bucket: bucket,
Key: id,
Expires: 300,
Metadata: metadata,
};
this.s3ClientAccelerate.getSignedUrl('putObject', params);
推荐答案
只需添加ContentMD5即可.
Just add ContentMD5 like this.
const params = { Bucket: bucket, Key: id, Expires: 300, Metadata: metadata,ContentMD5: md5, };
并确保在客户端的标头中传递Content-MD5.
And make sure you pass Content-MD5 in headers of client.
这篇关于如何在节点js的预签名url请求中发送内容md5标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!