I have the following code using presigned_url:
def upload_parameters_md5
put = aws_object.presigned_url(:put,
content_md5: md5_base64,
content_type: mime_type,
cache_control: 'public, max-age=2592000',
metadata: {
fileid: id,
},
)
{
method: 'PUT',
fields: {},
url: put,
headers: {
'content-md5': md5_base64,
'content-type': mime_type,
'cache-control': 'public, max-age=2592000',
'x-amz-meta-fileid': id
}
}
end
I want to add the custom metadata fileid but if i send the request as is i get a 403 error 'There were some headers which were not signed - x-amz-meta-fileid'. But if i remove x-amz-meta-fileid from the header the request goes through successfully.
Is this the correct way to add custom metadata? Will the signature be calculated correctly? And why are there no error when adding the other metadatas content-md5, content-type etc?