diff options
Diffstat (limited to 'functions')
| -rw-r--r-- | functions/render.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/functions/render.js b/functions/render.js index 28a64417..a35860a1 100644 --- a/functions/render.js +++ b/functions/render.js @@ -4,7 +4,10 @@ const validationString = process.env.AUTHORIZATION_STRING; function renderRoute(req, res, page, title, protected = false, data = {}) { res.locals.messages = req.flash(); let currentDomain = req.get("host").split("."); - currentDomain = req.protocol + "://" + currentDomain.at(-2) + "." + currentDomain.at(-1); + + // get the ':scheme' from the request header + let scheme = req.headers['X-Forwarded-Proto'] || req.protocol; + currentDomain = scheme + "://" + currentDomain.at(-2) + "." + currentDomain.at(-1); jwt.verify(req.cookies.token, validationString, (err, decoded) => { if (err) { res.clearCookie("token"); |
