Merge pull request #1159 from raoulsullivan/squashed_proxy_parameters

[proxyUrl] pass URL parameters to proxied URL
This commit is contained in:
Victor Woeltjen 2016-08-31 09:31:01 -07:00 committed by GitHub
commit 68adea7b5a

10
app.js
View File

@ -67,10 +67,14 @@
});
app.use('/proxyUrl', function proxyRequest(req, res, next) {
console.log('Proxying request to: ', req.query.url);
var targetUrl = req.query.url;
var queryParameters = req.query;
console.log('Proxying request to: ', targetUrl);
delete queryParameters['url'];
req.pipe(request({
url: req.query.url,
strictSSL: false
url: targetUrl,
strictSSL: false,
qs: queryParameters
}).on('error', next)).pipe(res);
});