使用HTTP代理的NodeJS中的Firebase [英] Firebase in NodeJS with HTTP Proxy

查看:161
本文介绍了使用HTTP代理的NodeJS中的Firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题让Node通过代理连接到Firebase。 b
$ b

当不通过代理(在开发机器上)运行时,或者我在浏览器后面运行代理时,应用程序可以正常工作。当部署在无法绕过代理服务器的服务器上时,会出现问题。



我找不到任何关于Firebase如何选择代理设置的文档,我可以告诉Firebase关于代理。是否有可能从代理后面运行Firebase(在节点中)?应该如何配置代理设置?

解决方案

我有同样的问题,并且偶然发现了这个线程。 b
$ b

@Kato:谢谢你的提示!对于开发/测试的目的,我劫持了faye-websocket,并能够通过代理连接。

即在faye \websocket\client.js中,我硬编码(我知道这是坏的,但它应该是好的开发的目的)下面的代理配置,

  var Client = function _url,protocols,options){
options = options || {};
$ b $ options.proxy = {
origin:'http:// localhost:8888',
headers:{'User-Agent':'node'},
} ...

现在连接正常:)

I'm having some issues getting Node to connect to Firebase through a proxy.

The application works fine when not running via the proxy (on a dev machine), or if I am running in the browser behind a proxy. The problem occurs when it is deployed on a server that can't bypass the proxy.

I can't find any documentation on how Firebase picks up proxy settings, or how I can tell Firebase about the proxy. Is it possible to run Firebase (in Node) from behind a proxy? How should the proxy settings be configured?

解决方案

I am having same problem, and stumbled opon this thread.

@Kato: thanks for the hint! For dev/test purpose, I hijacked faye-websocket and am able to connect via a proxy.

ie, in faye\websocket\client.js, I hardcoded (I know it is bad, but it should be fine for dev purposes) the below proxy config,

var Client = function(_url, protocols, options) {
  options = options || {};

  options.proxy = {
    origin:  'http://localhost:8888',
    headers: {'User-Agent': 'node'},
  }  ....

It is connecting fine now :)

这篇关于使用HTTP代理的NodeJS中的Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆