Skip to content

Commit

Permalink
Support Host header overriding URI
Browse files Browse the repository at this point in the history
  • Loading branch information
riy committed May 13, 2022
1 parent d06025e commit cf65cc9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions AWSSignature4DynamicValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
})
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cf65cc9

Please sign in to comment.