From cf65cc9f732180ba81bf9c1ce6c977893f8a6550 Mon Sep 17 00:00:00 2001 From: "Rias A. Sherzad" Date: Fri, 13 May 2022 20:04:38 +0200 Subject: [PATCH] Support Host header overriding URI --- AWSSignature4DynamicValue.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AWSSignature4DynamicValue.js b/AWSSignature4DynamicValue.js index 39a8d53..ed47762 100644 --- a/AWSSignature4DynamicValue.js +++ b/AWSSignature4DynamicValue.js @@ -247,7 +247,7 @@ var AWSSignature4DynamicValue = function() { if (headersArray) { headersArray.forEach(function(header) { var lower = header.name.getEvaluatedString().toLowerCase() - if (lower.startsWith('x-amz-')) { + if (lower.startsWith('x-amz-') || lower === 'host') { headers[lower] = header.value.getEvaluatedString(); } }) @@ -275,7 +275,6 @@ var AWSSignature4DynamicValue = function() { // AWS wants the URI normalized (except for s3 which is not normalized) path URL encoded according to RFC 3986. // Each path segment should be URI-encoded **twice** except for s3 which only gets URI-encoded once. - var target = uri.pathname; var canonicalURI = encodeComponents(uri.pathname, service === 's3' || service === 'execute-api'); // Step 1