From 3e99a888c44d7c6ff08b7fe1511b2a6db26c8582 Mon Sep 17 00:00:00 2001 From: Kasra Bigdeli Date: Fri, 24 Apr 2020 19:11:25 -0400 Subject: [PATCH 1/2] Not necessarily all netdata installations are on HTTPS --- src/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index a4f7026..2d7a4e9 100644 --- a/src/app.ts +++ b/src/app.ts @@ -109,7 +109,7 @@ app.use(CaptainConstants.netDataRelativePath, function(req, res, next) { 0 ) { let newUrl = - 'https://' + + 'http://' + req.get('host') + CaptainConstants.netDataRelativePath + '/' From 3cac9bbead88b838740dd8d7d2dff959ccd9ec69 Mon Sep 17 00:00:00 2001 From: Kasra Bigdeli Date: Thu, 30 Apr 2020 19:21:52 -0400 Subject: [PATCH 2/2] Use HTTPS for netdata if source is HTTPS --- src/app.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index 2d7a4e9..c5a4a68 100644 --- a/src/app.ts +++ b/src/app.ts @@ -108,8 +108,10 @@ app.use(CaptainConstants.netDataRelativePath, function(req, res, next) { req.originalUrl.indexOf(CaptainConstants.netDataRelativePath + '/') !== 0 ) { + let isRequestSsl = req.secure || req.get('X-Forwarded-Proto') === 'https' + let newUrl = - 'http://' + + (isRequestSsl? 'https://' : 'http://') + req.get('host') + CaptainConstants.netDataRelativePath + '/'