Last active
August 19, 2019 07:09
-
-
Save Korver2017/465dbd81a866bfb58fae17c6dd79f2fe to your computer and use it in GitHub Desktop.
Revisions
-
Korver2017 revised this gist
Aug 19, 2019 . 1 changed file with 18 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,21 @@ if (req.method === 'OPTIONS') { // CORS Preflight res.send(); } else { // var targetURL = req.header('Target-URL'); var targetURL = req.header('Target-Endpoint'); if (!targetURL) { res.send(500, { error: 'There is no Target-Endpoint header in the request' }); return; } // request({ url: targetURL + req.url, method: req.method, json: req.body, headers: {'Authorization': req.header('Authorization')} }, request({ url: targetURL + req.url, method: req.method, json: req.body, headers: { 'Authorization': req.header('Target-Endpoint') } }, function (error, response, body) { if (error) { console.error('error: ' + response.statusCode) } // console.log(body); }).pipe(res); } -
Korver2017 revised this gist
Aug 17, 2019 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,17 +2,15 @@ if (req.method === 'OPTIONS') { // CORS Preflight res.send(); } else { // var targetURL = req.header('Target-URL'); var targetURL = req.header('Target-Endpoint'); if (!targetURL) { res.send(500, { error: 'There is no Target-Endpoint header in the request' }); return; } // request({ url: targetURL + req.url, method: req.method, json: req.body, headers: {'Authorization': req.header('Authorization')} }, request({ url: targetURL + req.url, method: req.method, json: req.body, headers: {'Authorization': req.header('Target-Endpoint')} }, function (error, response, body) { if (error) { -
Korver2017 revised this gist
Aug 16, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,15 +2,16 @@ if (req.method === 'OPTIONS') { // CORS Preflight res.send(); } else { // var targetURL = req.header('Target-URL'); var targetURL = req.header('Target-Endpoint'); if (!targetURL) { res.send(500, { error: 'There is no Target-Endpoint header in the request' }); return; } // request({ url: targetURL + req.url, method: req.method, json: req.body, headers: {'Authorization': req.header('Authorization')} }, request({ url: targetURL + req.url, method: req.method, json: req.body, headers: {'Authorization': targetURL} }, function (error, response, body) { -
Korver2017 created this gist
Aug 16, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ if (req.method === 'OPTIONS') { // CORS Preflight res.send(); } else { // var targetURL = req.header('Target-URL'); var targetURL = req.header('Target-Endpoint'); if (!targetURL) { res.send(500, { error: 'There is no Target-Endpoint header in the request' }); return; } // request({ url: targetURL + req.url, method: req.method, json: req.body, headers: {'Authorization': req.header('Authorization')} }, request({ url: targetURL + req.url, method: req.method, json: req.body, headers: {'Authorization': targetURL} }, function (error, response, body) { if (error) { console.error('error: ' + response.statusCode) } // console.log(body); }).pipe(res); }