Skip to content

Commit

Permalink
fix(api-file-manager-s3): set presigned URLs to expire after 1 hour
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 committed Aug 14, 2024
1 parent 4913644 commit a034764
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import { SharpTransform } from "~/assetDelivery/s3/SharpTransform";

export type AssetDeliveryParams = Parameters<typeof createBaseAssetDelivery>[0] & {
imageResizeWidths?: number[];
/**
* BE CAREFUL!
* Setting this to more than 1 hour may cause your URLs to still expire before the desired expiration time.
* @see https://repost.aws/knowledge-center/presigned-url-s3-bucket-expiration
*/
presignedUrlTtl?: number;
};

Expand All @@ -17,8 +22,8 @@ export const assetDeliveryConfig = (params: AssetDeliveryParams) => {
const region = process.env.AWS_REGION as string;

const {
// Presigned URLs last 7 days (maximum length allowed by AWS).
presignedUrlTtl = 604800,
// Presigned URLs last 1 hour
presignedUrlTtl = 3600,
imageResizeWidths = [100, 300, 500, 750, 1000, 1500, 2500],
...baseParams
} = params;
Expand Down

0 comments on commit a034764

Please sign in to comment.