0
node.jsにHTTPプロキシを作成しようとしていますが、要求を取得してサーバに新しいリクエストを行います。私の目的は、しばらくの間、クロスオリジンの問題を取り除いて、アプリケーションをテストすることです。私はNode.jsの中に完全に初心者をM、私は正しい道の上にいますNode.jsのhttpプロキシ
_stream_readable.js:536
var ret = dest.write(chunk);
dest.write is not a function
: は、しかし、私は例外を取得mは?それとももっと良い方法がありますか?
app.get('/tlq', (req, res) => {
console.log('serve: ' + req.url);
var options = {
hostname: 'www.google.com',
port: 80,
path: req.url,
method: 'GET'
};
var proxy = http.request(options, function (res) {
res.pipe(res, {
end: true
});
});
req.pipe(proxy, {
end: true
});
});