moxiecode / plupload

Plupload is JavaScript API for building file uploaders. It supports multiple file selection, file filtering, chunked upload, client side image downsizing and when necessary can fallback to alternative runtimes, like Flash and Silverlight.
http://www.plupload.com
GNU Affero General Public License v3.0
5.63k stars 1.43k forks source link

Support AWS Signature Version 4 #1201

Open niko001 opened 9 years ago

niko001 commented 9 years ago

Plupload currently works great with S3 buckets, but only for the default (US) region. Other datacenters, such as Frankfurt, don't work because Plupload seems to be using an older AWS Signature Version.

Any new regions after January 30, 2014 will support only Signature Version 4 and therefore all requests to those regions must be made with Signature Version 4. (Source)

Could the signing method for S3 uploads be upgraded?

jayarjo commented 9 years ago

Do you mean our S3 example is outdated or that Plupload is not compatible with new signing version?

niko001 commented 9 years ago

Thanks for your reply, Davit! Hmm, you're right, only the example would need to be updated, since Plupload itself doesn't generate the policy/signature. I was under the impression that there is some behind-the-scenes magic going on to generate these, but it's all happening in the example-PHP itself. I'll try to implement V4 using the Amazon docs myself and will post the working code here so the wiki can be updated accordingly.

Sindoweb commented 9 years ago

Hello noki001,

Did you get this working? I'm facing the same challenge at this moment.

niko001 commented 9 years ago

@Meersie Not yet, sorry. AWS signature V4 seems excessively complex, have a look here: https://github.com/aws/aws-sdk-php/blob/master/src/Aws/Common/Signature/SignatureV4.php and https://github.com/chrismeller/awstools/blob/master/aws/signature/v4.php

I've currently resorted to simply using the US default region.

Sindoweb commented 9 years ago

@niko001 - No worries. I'll have a stab at it shortly and see where I end up.

JordanMagnuson commented 9 years ago

Not sure if this is the same issue, or not, but I was having trouble getting Plupload to upload directly to an S3 bucket in EU-WEST (Ireland) using the Plupload S3 example.

I got it to work by setting acl to 'private' AND adding 'success_action_status' in my policy and multipart_params (as per http://stackoverflow.com/a/4639529/299337 ) -- neither change worked by itself. For some reason guidance to set 'success_action_status' was recently removed from the Plupload S3 example code... is there a reason why?

Anyway, I'm not sure if these issues are related to signature v4, but like I said, those changes did allow me upload directly to an S3 bucket in EU-WEST.

jaredcassidy commented 7 years ago

Hi All

I managed to modify the example S3 upload page to work with Sig 4.

I worked off another example which can be found here: https://www.sanwebe.com/2015/09/direct-upload-to-amazon-aws-s3-using-php-html

Removed the redirect option as I dont think that is needed, and it required some extra CORS permissions.

Example can be seen here:

https://gist.github.com/jaredcassidy/1fb6af1c46f7b45bfc23cee90fbe4a3a

jaredcassidy commented 7 years ago

If you would like me to try my hand at making a pull request to update the example let me know :)

jayarjo commented 7 years ago

@jaredcassidy sure, that'd be great.

indicalabs commented 6 years ago

Signature Version 4 is not working.

pszalko commented 5 years ago

@indicalabs I think I found the solution after digging around AWS Signature Version 4: https://github.com/moxiecode/plupload/issues/1549#issuecomment-481337789