From 70f575eee75a0aa5c1b4f05b0871a94598b53d17 Mon Sep 17 00:00:00 2001 From: Aaron Ault Date: Sat, 11 Apr 2020 21:39:33 -0400 Subject: [PATCH] Added option to force protocol to https --- index.js | 4 +++- package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 4a71a6f..4d2ace0 100644 --- a/index.js +++ b/index.js @@ -46,7 +46,9 @@ function wellKnownJSON (options, resources) { var m = req.path.match(WELL_KNOWN) var base = options.baseUri || - (req.headers['x-forwarded-proto'] || req.protocol) + + (options.forceProtocol || + req.headers['x-forwarded-proto'] || + req.protocol) + '://' + (req.headers['x-forwarded-host'] || req.headers.host) diff --git a/package.json b/package.json index 69df0c5..97768ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oada/well-known-json", - "version": "1.0.0", + "version": "1.0.1", "description": "Middleware for JSON Well-Known resources", "main": "index.js", "scripts": {