mirror of
https://github.com/nasa/openmct.git
synced 2025-06-01 23:20:50 +00:00
[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
This commit is contained in:
parent
5409e3d203
commit
98486f718b
10
app.js
10
app.js
@ -67,10 +67,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.use('/proxyUrl', function proxyRequest(req, res, next) {
|
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({
|
req.pipe(request({
|
||||||
url: req.query.url,
|
url: targetUrl,
|
||||||
strictSSL: false
|
strictSSL: false,
|
||||||
|
qs: queryParameters
|
||||||
}).on('error', next)).pipe(res);
|
}).on('error', next)).pipe(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user