nodejs简易代理服务器
直接代码:
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')
作者:程序员小波与Bug
出处:https://codetrips.cn
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。如有问题,可以邮件:caiya928@aliyun.com
QQ:1419901425 联系我
如果喜欢我的文章,请关注我的公众号:程序员小波与Bug

浙公网安备 33010602011771号