From 3cac9bbead88b838740dd8d7d2dff959ccd9ec69 Mon Sep 17 00:00:00 2001 From: Kasra Bigdeli Date: Thu, 30 Apr 2020 19:21:52 -0400 Subject: [PATCH] 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 + '/'