因此,我使用restifyJS 来接收SNS 通知,并为其创建了一个主题并使用适当的ARN 订阅了它。我使用了 https 端点,当我请求确认时,我会收到以下 header 。
{
connection: 'upgrade',
'x-real-ip': '*****************My IP address *****************',
'x-forwarded-for': '*************My IP address ************',
host: 'localhost:3000',
'content-length': '1530',
'x-amz-sns-message-type': 'SubscriptionConfirmation',
'x-amz-sns-message-id': '*************************************',
'x-amz-sns-topic-arn': 'arn:aws:sns:ap-south - ************',
'content-type': 'text/plain; charset=UTF-8',
'user-agent': 'Amazon Simple Notification Service Agent',
'accept-encoding': 'gzip,deflate'
}
但我没有获得订阅 URL。
最佳答案
如上所述,URL 位于请求正文中。另请注意,主体是 JSON,但内容类型设置为 text/plain,这可能会导致某些解析器提供空请求主体。 您可以为 Restify 提供一个文本/纯格式格式化程序,根据“x-amz-sns-message-type” header 的存在情况来解析 SNS 消息的 json 内容。
关于node.js - 在 AWS 中 SNS 提供的 header 列表中未收到订阅 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52812374/