Compare commits

...

2 Commits

Author SHA1 Message Date
5eebc434bb 1.0.27 2019-09-20 19:19:33 +02:00
ed03c3ec4b fix(core): update 2019-09-20 19:19:33 +02:00
3 changed files with 12 additions and 3 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartproxy",
"version": "1.0.26",
"version": "1.0.27",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartproxy",
"version": "1.0.26",
"version": "1.0.27",
"private": false,
"description": "a proxy for handling high workloads of proxying",
"main": "dist/index.js",

View File

@ -97,8 +97,17 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
}, async (req, res) => {
console.log('got request');
const destinationConfig = this.router.routeReq(req);
let destinationUrl: string;
if (destinationConfig) {
destinationUrl = `http://${destinationConfig.destinationIp}:${destinationConfig.destinationPort}${req.url}`;
} else {
res.writeHead(404);
res.end('This route is not available on this server\n');
return;
}
console.log(destinationUrl);
const response = await plugins.smartrequest.request(
`http://${destinationConfig.destinationIp}:${destinationConfig.destinationPort}${req.url}`,
destinationUrl,
{
method: req.method,
headers: req.headers