Skip to content

Commit e6bbcc5

Browse files
MatthewHepburndekobon
authored andcommitted
Add explanatory comment
1 parent 214bfed commit e6bbcc5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

common/etc/nginx/include/s3gateway.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ async function fetchCredentials(r) {
989989

990990
if (current) {
991991
// If AWS returns a Unix timestamp it will be in seconds, but in Date constructor we should provide timestamp in milliseconds
992+
// In some situations (including EC2 and Fargate) current.expiration will be an RFC 3339 string - see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#instance-metadata-security-credentials
992993
const expireAt = typeof current.expiration == 'number' ? current.expiration * 1000 : current.expiration
993994
const exp = new Date(expireAt).getTime() - maxValidityOffsetMs;
994995
if (NOW.getTime() < exp) {

0 commit comments

Comments
 (0)