django-storages icon indicating copy to clipboard operation
django-storages copied to clipboard

Make it easy to customise expiration for cloudfront

Open Mogost opened this issue 1 year ago • 3 comments

Fix #1222

Mogost avatar Mar 28 '23 09:03 Mogost

Hi thanks for the PR.

Instead of this solution how about one where expire can be any of int|datetime|timedelta? Would that solve your problem?

jschneier avatar Sep 09 '23 23:09 jschneier

Hi. That doesn't help me in any way.

expiration = datetime.utcnow() + timedelta(seconds=expire)

If we're talking about this expression, I have a problem with the part datetime.utcnow() not in timedelta(seconds=expire).

My goal is for links to be generated at discrete time intervals. Like: 1:00 -> 1:30 1:05 -> 1:30 1:15 -> 1:45 1:29 -> 1:45 1:30 -> 2:00 In this case, my link is valid at least 15 minutes. Maximum validity is 30 min. Now it works like 1:00 -> 1:30 1:01 -> 1:31 And it doesn't give any chance for the cache to work.

My change basically makes it easier to make changes. But doesn't make any changes to the result of the work.

Mogost avatar Sep 11 '23 12:09 Mogost

Yes but if you could pass in expire=some_datetime I think that would solve your problem?

jschneier avatar Sep 11 '23 16:09 jschneier