Proxy nodejs requests through Proxy Server

If you want to proxy all Nodejs HTTP requests through a proxy server, just like JVM’s

-Dhttp.proxyHost= -Dhttp.proxyPort=8888

Here is the quickest solution, without modifying the application source code

npm i global-agent
node -r 'global-agent/bootstrap' app.js

This will enable you to proxy all requests through proxy server running at on port 8888, which could be Charles or Burp