有没有办法查找apigateway端点的区域并使用它来用sigv4签署您的请求?
我正在使用aws sdk进行签名
let req = new AWS.HttpRequest( endpoint );
req.method = 'POST';
req.path = endpoint.path;
req.region = QueryApi.getBaseUrlRegion( this._baseUrl );
req.body = JSON.stringify( body );
req.headers[ 'Host' ] = endpoint.host
req.headers[ 'presigned-expires' ] = false
req.headers[ 'Content-Type' ] = 'application/json'
let signer = new AWS.Signers.V4( req, 'execute-api' )
signer.addAuthorization( this._awsCreds, new Date() )
现在我正在从内部aws execute-api url解析该区域,但这不适用于自定义dns名称。
是使用配置或进行DNS查找的唯一选项吗?
答案 0 :(得分:1)
Unfortunately, currently there isn't a way to look up the region when using a custom domain name. Using DNS lookup will not work as well because API Gateway is fronted by CloudFront distributions.