我为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 .....