【发布时间】:2022-11-08 12:28:28
【问题描述】:
我最近开始为 AppSync API 使用自定义 Lambda 授权方,该 API 运行良好,但在该授权方中发现了对源 IP 地址的要求。
我一直在做一些谷歌搜索,可以找到很多关于如何在速度模板中获取 IP 地址以及如何使用 API Gateway 授权方执行此操作的信息,但无法在 AppSync 授权方中找到获取它的位置。我希望有人能帮忙。
在授权人中,如果我添加此代码:
exports.handler = async (event, context, callback) => {
console.log('EVENT', event);
console.log('CONTEXT', context);
console.log('CALLBACK', callback);
}
我可以看到我无权访问任何标题,我希望看到 X-Forwarded-For 标题,但它不存在。
EVENT {
authorizationToken: '<removed>',
requestContext: {
apiId: '<removed>',
accountId: '<removed>',
requestId: '<removed>',
queryString: '<removed>',
variables: {}
}
}
CONTEXT {
callbackWaitsForEmptyEventLoop: [Getter/Setter],
succeed: [Function (anonymous)],
fail: [Function (anonymous)],
done: [Function (anonymous)],
functionVersion: '$LATEST',
functionName: '<removed>',
memoryLimitInMB: '128',
logGroupName: '/aws/lambda/<removed>',
logStreamName: '2021/11/25/[$LATEST]<removed>',
clientContext: undefined,
identity: undefined,
invokedFunctionArn: '<removed>,
awsRequestId: '<removed>',
getRemainingTimeInMillis: [Function: getRemainingTimeInMillis]
}
CALLBACK [Function (anonymous)]
有谁知道我如何在授权者级别公开 IP?
这是身份验证设置,我似乎找不到任何进一步的设置。
【问题讨论】:
标签: amazon-web-services aws-lambda aws-appsync