Skip to content

Commit

Permalink
include x-amz-website-redirect-location as canonical header
Browse files Browse the repository at this point in the history
  • Loading branch information
kherock committed Jun 7, 2020
1 parent 9dcfc37 commit 31dbfc3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/middleware/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ module.exports = () =>

const amzQueryHeaders = pickBy(
mapKeys(ctx.query, (value, key) => key.toLowerCase()),
(value, key) =>
key.startsWith('x-amz-') &&
// x-amz-website-redirect-location isn't a canonical header
key !== 'x-amz-website-redirect-location',
(value, key) => key.startsWith('x-amz-'),
);
// x-amz-* values specified in query params take precedence over those in the headers
Object.assign(ctx.headers, amzQueryHeaders);
Expand Down Expand Up @@ -125,11 +122,7 @@ module.exports = () =>
.replace(/=(&|$)/g, ''); // remove trailing = for empty params

const canonicalizedAmzHeaders = Object.keys(ctx.headers)
.filter(
headerName =>
headerName.startsWith('x-amz-') &&
headerName !== 'x-amz-website-redirect-location',
)
.filter(headerName => headerName.startsWith('x-amz-'))
.sort()
.map(
headerName =>
Expand Down

0 comments on commit 31dbfc3

Please sign in to comment.