Skip to content

Expiration needs to be set in UTC #41

@Prinzhorn

Description

@Prinzhorn

The defaultExpireTime uses the local time as do the examples in the docs. If you're ahead of UTC (e.g most of Europe) the links are expired as you create them. If you're behind UTC (e.g. all of USA) the links is valid longer than you think.

var defaultExpireTime = Math.round(Date.now() + 1800000);

There is not a really nice way in JavaScript without resorting to Moment.js or the like. https://stackoverflow.com/questions/948532/how-do-you-convert-a-javascript-date-to-utc

var now = new Date(); 
var nowUTC = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),  now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
var defaultExpireTime = Math.round(nowUTC.getTime() + 1800000);

Moment.js

moment().utc().add(1, 'day')

screen shot 2017-07-31 at 11 08 28

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-custom-policy.html

{"AWS:EpochTime":required ending date and time in Unix time format and UTC}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions