【问题标题】:How to use Firebase behind Firewall / Proxy?如何在防火墙/代理后面使用 Firebase?
【发布时间】:2019-04-15 23:42:28
【问题描述】:

我们正在运行一个连接到 Firebase 的简单应用程序来读取一些数据。连接失败,出现以下超时错误:

@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 才能使此应用程序正常工作?

任何帮助将不胜感激!

【问题讨论】:

    标签: firebase proxy firewall web-application-firewall


    【解决方案1】:

    最后,经过几天的努力解决了这个问题。需要联系网络团队并请求执行以下操作:

    1. 为 Firebase 通信打开端口 5228、5229、5230。
    2. 在源服务器和以下 URL 之间在代理级别打开通信:

      fcm.googleapis.com

      gcm-http.googleapis.com

      accounts.google.com

      {项目名称}.firebaseio.com

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

      var globalTunnel = require('global-tunnel-ng');
      
      globalTunnel.initialize({
        主机:'',
        端口:,
        //proxyAuth: 'userId:password', // 可选认证
        sockets: 50 // 每个 http 和 https 的可选池大小
      });
    4. 已安装模块global-tunnel-ng:

      npm install global-tunnel-ng

    它解决了我的问题,我希望它也可以帮助其他人。 :-)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-16
      • 1970-01-01
      • 1970-01-01
      • 2014-06-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多