From 3021aa4ddd5e8468f0813f9c323b7c0a57c11332 Mon Sep 17 00:00:00 2001 From: Antonio Calanducci Date: Tue, 4 Jun 2024 16:46:44 +0200 Subject: [PATCH] Add https protocol and hostname to redirect URLs --- src/config.js | 2 -- src/pep.js | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/config.js b/src/config.js index 69dee3d..692ff9e 100644 --- a/src/config.js +++ b/src/config.js @@ -3,8 +3,6 @@ export default { config }; var config = { "pep_credentials": "pep_credentials", "debug": true, - "legacy": true, - "stripLegacyToken": false, "accounting": { "scopes": ["authorized_scope1", "authorizeed_scope2"], "service_name": "docker_stack_name", diff --git a/src/pep.js b/src/pep.js index 3dd0e10..4150741 100644 --- a/src/pep.js +++ b/src/pep.js @@ -91,10 +91,10 @@ function enforce_legacy(r) { context.request.subrequest("/_accounting_legacy", { detached: true, body: JSON.stringify([context.record]) }) // r.return(reply.status, reply.responseBody) log(context, "Accounting record sent:\n" + JSON.stringify(context.record, null, 2)) - debug(context, "Redirect URI: " + reply.headersOut["Location"]) + debug(context, "Redirect URI: https://" + r.headersIn.host + reply.headersOut["Location"]) if (reply.status === 301 || reply.status === 302) { debug(context, "Redirecting..."); - r.return(reply.status, reply.headersOut["Location"]) + r.return(reply.status, "https://" + r.headersIn.host + reply.headersOut["Location"]) } else { r.return(reply.status, reply.responseText) }