2

To launch Node.js app one needs to run node app.js

The app is to read data from Internet.

Now I work behind firewall and the target server is only available via proxy that is running as localhost:3213

I don't want to change OS setting and allow all apps to use the proxy.

How to specify proxy for launched Node.js app without changing JavaScript code?

Node options (listed with node -h) don't give hint.

How can I use an http proxy with node.js http.Client? refers to altering Node app.

For Java I can pass [Java] system properties via -D parameters

java -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3213 -Dhttp.nonProxyHosts=”localhost|host.example.com” MyJavaApplication

Community
  • 1
  • 1
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
  • possible duplicate of [How can I use an http proxy with node.js http.Client?](http://stackoverflow.com/questions/3862813/how-can-i-use-an-http-proxy-with-node-js-http-client) – xmojmr Feb 27 '15 at 16:10
  • That is very close, but that requires modifying Node.js app. How to do that for any app someone has? – Paul Verest Feb 28 '15 at 02:07
  • 1
    Its probably impossible, unless you loosen the constraints and let the OS handle the task (proxy, firewall, antivirus are OS-level components). For instance one of my `node.js` applications (an _any_ app) uses `cUrl` to do some download/upload stuff. The `cUrl` module connects to the internet using it's own logic and it's own set of libraries (it is not pure-node module). It's out of control of the `node` runtime (and it's possible hacks). It seems that you are looking for a shell sandbox or virtual machine. "Super User" or "Server Fault" sites can be helpful at that – xmojmr Feb 28 '15 at 07:34

0 Answers0