我已经为 aws s3 存储桶对象生成了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)
当我替换 url (它有效) 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 .....