Add https protocol and hostname to redirect URLs

This commit is contained in:
Antonio Calanducci 2024-06-04 16:46:44 +02:00
parent 8cb8df28c9
commit 3021aa4ddd
2 changed files with 2 additions and 4 deletions

View File

@ -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",

View File

@ -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)
}