I was working in a corporate network behind a proxy server. In my code I can set the proxy by using the approach mentioned in this thread.
But the problem is that mo
While not a Nodejs setting, I suggest you use proxychains which I find rather convenient. It is probably available in your package manager.
After setting the proxy in the config file (/etc/proxychains.conf for me), you can run proxychains npm start or proxychains4 npm start (i.e. proxychains [command_to_proxy_transparently]) and all your requests will be proxied automatically.
Config settings for me:
These are the minimal settings you will have to append
## Exclude all localhost connections (dbs and stuff)
localnet 0.0.0.0/0.0.0.0
## Set the proxy type, ip and port here
http 10.4.20.103 8080
(You can get the ip of the proxy by using nslookup [proxyurl])