Firebase in NodeJS with HTTP Proxy

firebase

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?

Best Solution

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 :)

Related Question