简体   繁体   English

从 Firebase Callable 函数获取用户 IP 地址

[英]Get users IP address from Firebase Callable function

How can I access the users IP address from an onCall Firebase function...如何从onCall Firebase 函数访问用户 IP 地址...

exports.MyFunction = functions.https.onCall((data, context) => {
   var IPAddress; //???
   console.log(IPAddress)
});

I saw that I might be able to get the IP address with context.rawRequest.connection.remoteAddress but then I saw this post regarding an http function, and I'm not sure how to set the headers on an onCall function to fastly-client-ip .我看到我可能能够通过context.rawRequest.connection.remoteAddress获取 IP 地址,但后来我看到了关于http函数的这篇文章,我不确定如何将onCall函数的标头设置为fastly-client-ip

Any suggestions?有什么建议?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM