From 98486f718baf6a6f0d07fb170920e4746d80cc7d Mon Sep 17 00:00:00 2001 From: raoulsullivan Date: Tue, 30 Aug 2016 18:59:31 +0100 Subject: [PATCH] [proxyUrl] pass URL parameters to proxied URL Addresses issue #1158 Passes query parameters on to proxyUrl proxied URL remove the url parameter before passing Naming convention for variables Re-order code to reuse variable --- app.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 6b7b1bb635..20429a3a5f 100644 --- a/app.js +++ b/app.js @@ -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); });