直接代码:

var http = require('http')
var proxy = http.createServer(function (request, response) {
  var options = {
    host: 'www.cnblogs.com', // 这里是代理服务器       
    port: 80, // 这里是代理服务器端口
    path: request.url,
    method: request.method
  }
  var req = http.request(options, function (res) {
    res.pipe(response);
  }).end();

}).listen(3000, 'localhost')

  

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-02-06
  • 2022-12-23
  • 2021-08-07
  • 2022-01-13
  • 2021-12-28
猜你喜欢
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-27
相关资源
相似解决方案