直接代码:

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')

  

相关文章:

  • 2022-01-27
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-10-03
猜你喜欢
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
相关资源
相似解决方案