@defra/lis-hubs-infra-access 0.26.0-lreg-563.alpha.2 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -54,8 +54,10 @@ export function getReturnUrlFromRequest(request) {
|
|
|
54
54
|
* @returns {URL}
|
|
55
55
|
*/
|
|
56
56
|
export function buildCurrentRequestUrl(request, port) {
|
|
57
|
-
const
|
|
58
|
-
const
|
|
57
|
+
const forwardedProto = request.headers['x-forwarded-proto']
|
|
58
|
+
const protocol = typeof forwardedProto === 'string' ? forwardedProto : 'http'
|
|
59
|
+
const hostHeader = request.headers.host
|
|
60
|
+
const host = typeof hostHeader === 'string' ? hostHeader : `localhost:${port}`
|
|
59
61
|
const currentUrl = new URL(
|
|
60
62
|
request.raw.req.url ?? request.path,
|
|
61
63
|
`${protocol}://${host}`
|