aws s3与cloudflare SignatureDoesNotMatch错误

时间:2016-05-27 20:10:20

标签: ios amazon-s3 cloudflare amazon-mobile-hub

我为aws s3 bucket对象生成了signedurl,以便从aws ios mobile hub api获取我的图像。我可以在浏览器中访问我的图像。当我想通过cloudflare访问时,我会发现SignatureDoesNotMatch错误。 我配置了cloudflare cname。 cname xxx.com - > aws端点

AWSS3PreSignedURLBuilder *S3PreSignedURLBuilder = [AWSS3PreSignedURLBuilder S3PreSignedURLBuilderForKey:@"defaultManager"];
AWSS3GetPreSignedURLRequest *signedRequest = [AWSS3GetPreSignedURLRequest new];
signedRequest.bucket = @"bucketname"; // same mydomain (xxxx.com)
signedRequest.key = @"s3object";  // myfile name in root
signedRequest.HTTPMethod = AWSHTTPMethodGET;
signedRequest.expires = [NSDate dateWithTimeIntervalSinceNow:3600];

[[[AWSS3PreSignedURLBuilder defaultS3PreSignedURLBuilder] getPreSignedURL:signedRequest]
 continueWithBlock:^id(AWSTask *task) {

     if (task.error) {
         NSLog(@"Error: %@",task.error);
     } else {

         NSURL *presignedURL = task.result;

     }
     return nil;
 }];

bucketname = domain (xxxx.com)

当我更换网址时 (有用) https://s3.eu-central-1.amazonaws.com/xxxx.com/filename?X-Amz-Algorithm=AWS4 .....

与 (它不起作用) - SignatureDoesNotMatch错误 https://xxxx.com.s3.eu-central-1.amazonaws.com/filename?X-Amz-Algorithm=AWS4 .....

或 (它不起作用) - SignatureDoesNotMatch错误 https://xxxx.com/filename?X-Amz-Algorithm=AWS4 .....

https://s3.eu-central-1.amazonaws.com/cesurbagci.com/aabbcc?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAJQIWCZDSBJ2G2OWQ%2F20160527%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20160527T190445Z&X-Amz-Expires=3599&X-Amz-SignedHeaders=host&x-amz-security-token=FQoDYXdzEKz%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDGpkAYJB%2FGaLxKKNjyKeBAqZedG2BC8T8J8p8iimRFBddxw1nqRFFWBmhkxPHlTjWTh0HXuvn1K4nA8FLODXngBnZ%2BAaKj36tMGJoQAecL8cUtYaXdZLDWw4ENHrrNR6%2Bbk4Bs3gUibP2e8Rx4FWLmZrxPt%2FHIYRU765Yc9WNnN211pXjchLu2v3SLNIjOU%2BwwcWAravm7HJtj3tc9iKpPywiReL5DbMmwqFmULkG4oTCJz%2B4l70avak2yBVrW5%2B5QhaEzpNU93nn6L0Apd4Hsw6fgaB2WwPtB02tbEfBXSRPyVyreGhCW2ChmIITNt684NL7oJIruuGDrUrrJh4TbeH5O7jb3zn2bbU2VPQwmYtg%2FPnz1TMcxZ22%2BR8epT97oQ2S4Lgs4e9nNUzvZcMEmUNO%2FwozwXOM%2FMPkG13vkYThahf0OYFSgZEeacKm%2BR%2BBXvUUXbx1JVedqV%2F9PtABH%2FV4huMxK0op80zrVRpMdeP1BKzZ6OC530XODOuA6wArOAISskvjYhnV8C%2FLQMGENIIvejbqPjxMOBOq8fVfNx04j5ab%2F97iwcz7WTPSZCw0hPsKN48Fztw9xNzSgtR4H0zaPrkZ3QGroYpD4B%2BrSOOywLeQxpICaY49cuFAtlsNrSnKD5x%2BT%2BMla7yQi7gVHGcr7JZQ521w%2B9owtGeAV7OiqSSjAlu2LJE1gRtWnzzAz1w1L2tv%2BgGJKDZEQEzhUuYn3f6agRsN3SIhARzKM20oroF&X-Amz-Signature=456e9baf2a3ca995b5bebebe6ef9573e92a5c19a6a0d23b3de2fc6e9328a7392

0 个答案:

没有答案