nac*_*n f 5 ip-address node.js firebase google-cloud-functions
如何从onCallFirebase 函数访问用户 IP 地址...
exports.MyFunction = functions.https.onCall((data, context) => {
var IPAddress; //???
console.log(IPAddress)
});
Run Code Online (Sandbox Code Playgroud)
我看到我可能能够获取 IP 地址,context.rawRequest.connection.remoteAddress但后来我看到了有关函数的帖子,但我http不确定如何将onCall函数的标头设置为fastly-client-ip.
有什么建议?
小智 9
看:
https://firebase.google.com/docs/reference/functions/providers_https_.html#oncall https://firebase.google.com/docs/reference/functions/providers_https_.callablecontext.html https://firebase.google。 com/docs/reference/functions/providers_https_.request.html#ip
exports.myCallable = functions.https.onCall((data, context) => {
return context.rawRequest.ip;
});
Run Code Online (Sandbox Code Playgroud)
如果您需要路线信息:
https://firebase.google.com/docs/reference/functions/providers_https_.request.html#ips
| 归档时间: |
|
| 查看次数: |
1761 次 |
| 最近记录: |