如何在防火墙/代理后面使用Firebase?

编程入门 行业动态 更新时间:2024-10-23 15:31:02
本文介绍了如何在防火墙/代理后面使用Firebase?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我们正在运行一个简单的应用程序,该应用程序连接到Firebase会读取一些数据.它无法连接,并显示以下超时错误:

We are running a simple application that connects to Firebase are reads some data. It fails to connect with the following timeout error:

@firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential", "message":"Credential implementation provided to initializeApp() via the \"credential\" property failed to fetch a valid Google OAuth2 access token with the following error: \"Failed to parse access token response: Error: Error while making request: connect ETIMEDOUT

我们在防火墙/代理后面,并且似乎阻止了往返Firebase的通信,因此连接失败.我的问题是,需要打开哪些端口以及要使用哪个目标URL才能使该应用程序正常工作?

We are behind Firewall / Proxy and it appears that is blocking traffic to/from Firebase and hence failed connection. My question is what ports need to be opened and to what destination URLs to make this application work normally?

任何帮助将不胜感激!

推荐答案

最后,在为问题苦苦挣扎了几天之后,它开始工作了.需要联系网络团队并要求执行以下操作:

Finally, after struggling with the issue for several days got it working. Needed to contact network team and request to perform following actions:

  • 打开端口5228、5229、5230进行Firebase通信.
  • 在源服务器和以下URL之间的代理级别打开通信:

  • Open ports 5228, 5229, 5230 for Firebase communication.
  • Opened communication at proxy level between the source server and following URLs:

    fcm.googleapis

    fcm.googleapis

    gcm-http.googleapis

    gcm-http.googleapis

    accounts.google

    accounts.google

    {project-name} .firebaseio

    {project-name}.firebaseio

  • 在我的node.js应用程序中添加了以下代码:

  • Added following code in my node.js application:

    var globalTunnel = require('global-tunnel-ng'); globalTunnel.initialize({ host: '<proxy-url>', port: <proxy-port>, //proxyAuth: 'userId:password', // optional authentication sockets: 50 // optional pool size for each http and https });

  • 已安装模块global-tunnel-ng:

    npm install global-tunnel-ng

  • 它解决了我的问题,希望也能对其他人有所帮助. :-)

    It solved the my problem and I hope it can help others too. :-)

    更多推荐

    如何在防火墙/代理后面使用Firebase?

    本文发布于:2023-06-11 17:27:44,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/639746.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:防火墙   如何在   Firebase

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!