Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 如何解决api网关中的cors问题_Amazon Web Services_Cors_Aws Api Gateway - Fatal编程技术网

Amazon web services 如何解决api网关中的cors问题

Amazon web services 如何解决api网关中的cors问题,amazon-web-services,cors,aws-api-gateway,Amazon Web Services,Cors,Aws Api Gateway,我正在从AWS网关创建一个javascript SDK来调用我的api。我曾尝试添加文档和web中遇到的多个标题。但我找不到解决办法。我正在使用facebook对用户进行身份验证,我的api使用python AWS.config.region = region'; AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: identityPoolId ,

我正在从AWS网关创建一个javascript SDK来调用我的api。我曾尝试添加文档和web中遇到的多个标题。但我找不到解决办法。我正在使用facebook对用户进行身份验证,我的api使用python

AWS.config.region = region';
        AWS.config.credentials = new AWS.CognitoIdentityCredentials({
            IdentityPoolId: identityPoolId ,
            Logins: {
                'graph.facebook.com':fbTokenId

            }
        });
 AWS.config.credentials.get(function(){
            var identityId = AWS.config.credentials.identityId;
            var accessKeyId = AWS.config.credentials.accessKeyId;
            var secretAccessKey = AWS.config.credentials.secretAccessKey;
            var sessionToken = AWS.config.credentials.sessionToken;
            apigClient = apigClientFactory.newClient({
                                                        accessKey: accessKeyId,
                                                        secretKey: secretAccessKey,
                                                        sessionToken: sessionToken,
                                                        //region: region
                                                    });
apigClient.rootGet({},{},{})
                .then(function(result){
                  // Add success callback code here.
                 console.log("result : ");
                 console.log(result);
                }).catch( function(result){
                  // Add error callback code here.
                console.log(result);
                });
这就是我在控制台中看到的错误。 加载资源失败:服务器响应状态为403(禁止)
html:1无法加载XMLHttpRequest。请求的资源上不存在“Access Control Allow Origin”标头。因此,不允许访问源“null”。响应的HTTP状态代码为403。提前谢谢你的帮助

我发现了这个问题。区域不匹配。请确保区域正确

根据文件: 如果指定常规端点(elasticmapreduce.amazonaws.com),AmazonEMR会将您的请求定向到默认区域中的端点。对于2013年3月8日当天或之后创建的账户,默认区域为us-west-2;对于较旧的帐户,默认区域为us-east-1