Firebase in NodeJS with HTTP proxy

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

An application works fine if it is not running through a proxy (on a dev machine), or if I run in a browser behind a proxy server. The problem occurs when it is deployed to a server that cannot bypass the proxy.

I cannot find documentation on how Firebase selects proxy settings or how I can tell Firebase about a proxy server. Is it possible to start Firebase (in Node) due to a proxy server? How to configure proxy server settings?

+3
firebase
source share
3 answers

I have the same problem and stumbled upon this topic.

@Kato: thanks for the tip! For dev / test, I grabbed faye-websocket and can connect through a proxy.

those. in faye \ websocket \ client.js, I am hard-coded (I know this is bad, but it should be good for dev purposes) below the proxy configuration,

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

Now it connects perfectly :)

+7
source

Alas, this does not seem to be a global way to tell node to use proxies for outgoing connections. It's a little strange to have a server process behind a proxy. Typically, you can configure the server firewall to allow these socket connections rather than trying to route them through a proxy.

If you are desperate, you can probably grab the Faye-websocket WebSocket implementation and add proxy information similar to this approach , but intended for faye-websocket instead of the http module.

+4
source

var Client = function (_url, protocols, parameters) {

options = options || {};

options.proxy = {

origin: ' http: // localhost: 8888 ',

: {'User-Agent': 'node'},

} ....

my local proxy: http://127.0.0.1:8118 "

when i changed proxy uri it works for me. thaks @jho

+1
source

All Articles