Chunked Request: different header values on Sign vs Upload
genestd opened this issue · 1 comments
Hi, I'm getting a SignatureDoesNotMatch error on chunked uploads only. It seems that the header values are different on the signature request vs the POST request. The sign request looks like this:
POST
/556e749ae2b6350d6d47c68fdf2624a8/assets/ab45a649-3541-4651-a74e-fbfe05f897be
uploads=
host:s3-us-west-2.amazonaws.com
x-amz-acl:private
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20171216T010045Z
x-amz-meta-qqfilename:Postman-osx-5.3.2.zip
host;x-amz-acl;x-amz-content-sha256;x-amz-date;x-amz-meta-qqfilename
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
and the POST request looks like this:
POST
/sandbox-assets.bam.zone/556e749ae2b6350d6d47c68fdf2624a8/assets/ab45a649-3541-4651-a74e-fbfe05f897be
uploads=
host:s3-us-west-2.amazonaws.com
x-amz-acl:private
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20171216T010045Z
x-amz-meta-qqfilename:Postman-osx-5.3.2.zip
host;x-amz-acl;x-amz-content-sha256;x-amz-date;x-amz-meta-qqfilename
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
S3-fineuploader is adding the bucket name to the object key on the POST request. Here is my options object:
options: {
objectProperties: {
region: "us-west-2",
key: fileId => {
return `${this.props.user.client}/assets/${this.uploaderInstance.qq.getUniqueId(fileId)}`
},
host: `s3-us-west-2.amazonaws.com`,
bucket: config.bucket,
},
chunking: {
enabled: true
},
resume: {
enabled: true
},
request: {
endpoint: `${config.assetUrl}`,
accessKey: credentials.aws.accessKeyId,
},
signature: {
endpoint: `${config.baseUrl}/api/assets/signedPolicy`,
version: 4,
region: 'us-west-2',
customHeaders: {
Authorization: this.props.user.token
}
},
callbacks: {
onComplete: this.uploadCompleteHandler,
onAllComplete: this.allUploadsCompleteHandler,
onValidateBatch: this.validateBatchHandler,
onError: err => {
this.props.modalActions.setMessage({
type: 'ERROR',
msg: err.message || 'Unable to upload file'
})
this.props.modalActions.openModal('MessageModal')
}
},
I have searched the other issues and only found one similar problem - it appears the user changed the source code to resolve it. Is this user error or something in the code? Thanks!
React Fine Uploader is nothing more than UI code, so this isn't the appropriate place to file such an issue. If you can find a specific issue in Fine Uploader's code, please file an issue in the fine-uploader repo, but it sounds like this is an issue with your server signing code.