Answers for "how to proxy enable in server nodejs"

0

how to run node js with proxy

$ npm config set proxy http://localhost:3128
$ npm config set https-proxy http://localhost:3128
Posted by: Guest on April-24-2020
0

how to proxy enable in server nodejs

proxy=http://username:password@host:port
https-proxy=http://username:password@host:port
https_proxy=http://username:password@host:port
no_proxy=127.0.0.1,localhost.*.mtn.co.za
Posted by: Guest on June-23-2020
0

how to make a proxy server node.js

var fs = require('fs');

var http = require('http'),

var https = require('https'),

var httpProxy = require('http-proxy');

isHttps = true;

var options = {

  ssl: {

    key: fs.readFileSync('valid-key.pem'),

    cert: fs.readFileSync('valid-cert.pem')

  }

};

proxyServer = proxy.createProxyServer({target:'http://127.0.0.1:9000'});

proxyServer.listen(8000);

if (isHttps){

   server = https.createServer(options.ssl, function(req, res) {

     console.log(“https request”);

     proxyServer.web(req, res, { target: req.url });

     proxyServer.on('error', function(e) {

  console.log("Error in proxy call");

     });

     proxyServer.listen(443);

   });

}else{

  server = http.createServer(function (req, res) {

  console.log(req.url);

  proxyServer.web(req, res, { target: req.url });

  proxyServer.on('error', function(e) {

   console.log("Error in proxy call");

  });

    });

 }

 server.listen(9000);
Posted by: Guest on May-18-2020

Code answers related to "how to proxy enable in server nodejs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language