This pertains to Node.js versions greater than 4.0.0
re: https://stackoverflow.com/questions/45384853/proxy-request-with-node-js-neterr-empty-response/45385003#45385003
Why does this work:
router.post('/image', function (req, res, next) {
const filename = uuid.v4();
const proxy = http.request({
method: 'PUT',
hostname: 'engci-maven.nabisco.com',
path: `/artifactory/cdt-repo/folder/${filename}`,
headers: {
'Authorization': 'Basic ' + Buffer.from('foo:bar').toString('base64'),
}
}, function(resp){
resp.pipe(res).once('error', next);
});
req.pipe(proxy).once('error', next);
});
but this does not work:
router.post('/image', function (req, res, next) {
const filename = uuid.v4();
const proxy = http.request({
method: 'PUT',
hostname: 'engci-maven.nabisco.com',
path: `/artifactory/cdt-repo/folder/${filename}`,
headers: {
'Authorization': 'Basic ' + Buffer.from('foo:bar').toString('base64'),
}
});
req.pipe(proxy).pipe(res).once('error', next);
});
any info much appreciated.
This pertains to Node.js versions greater than 4.0.0
re: https://stackoverflow.com/questions/45384853/proxy-request-with-node-js-neterr-empty-response/45385003#45385003
Why does this work:
but this does not work:
any info much appreciated.