From d47829a8b203e84ce6b46d0ddd28e54cef3be940 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Fri, 29 Jul 2022 04:25:01 +0200 Subject: [PATCH] fix(core): update --- ts/00_commitinfo_data.ts | 2 +- ts/smartproxy.classes.networkproxy.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index cccda27..eda6d65 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartproxy', - version: '3.0.7', + version: '3.0.8', description: 'a proxy for handling high workloads of proxying' } diff --git a/ts/smartproxy.classes.networkproxy.ts b/ts/smartproxy.classes.networkproxy.ts index da8806d..588dbaf 100644 --- a/ts/smartproxy.classes.networkproxy.ts +++ b/ts/smartproxy.classes.networkproxy.ts @@ -117,9 +117,6 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= `, }, async (req, res) => { - console.log('got request'); - const destinationConfig = this.router.routeReq(req); - /** * endRequest function * can be used to prematurely end a request @@ -133,6 +130,15 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= res.end(messageArg); }; + console.log('got request'); + const destinationConfig = this.router.routeReq(req); + + if (!destinationConfig) { + console.log(`${req.headers.host} can't be routed properly. Terminating request.`); + endRequest(); + return; + } + // authentication if (destinationConfig.authentication) { const authInfo = destinationConfig.authentication;