I use Evaporate.js to upload files to S3. Everything works for me until I decided to enable encryption on the server side.
According to the S3 docs, you can enable it by passing the header. So I updated my code to add:
var promise = _e_.add({ name: name, file: files[i], started: callback_methods.started, complete: callback_methods.complete, cancelled: callback_methods.cancelled, progress: callback_methods.progress, error: callback_methods.error, warn: callback_methods.warn, paused: callback_methods.paused, pausing: callback_methods.pausing, resumed: callback_methods.resumed, nameChanged: callback_methods.nameChanged, xAmzHeadersAtInitiate: { 'x-amz-server-side-encryption': 'AES256'} // THIS IS THE ONLY LINE THAT CHANGED!!! } )
I get the error: DOMException: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 'AWS4-HMAC-SHA256 Credential=XXXXXXXXXXXXXXX/XXXXXXX/us-east-1/s3/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-server-side-encryption, Signature=XXXXXXXXXXXXXXXXXXXXX' is not a valid HTTP header field value.
javascript amazon-s3 amazon-web-services encryption
Muhambi
source share