Skip to content

Commit a034764

Browse files
committed
fix(api-file-manager-s3): set presigned URLs to expire after 1 hour
1 parent 4913644 commit a034764

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/api-file-manager-s3/src/assetDelivery/assetDeliveryConfig.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ import { SharpTransform } from "~/assetDelivery/s3/SharpTransform";
99

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

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

1924
const {
20-
// Presigned URLs last 7 days (maximum length allowed by AWS).
21-
presignedUrlTtl = 604800,
25+
// Presigned URLs last 1 hour
26+
presignedUrlTtl = 3600,
2227
imageResizeWidths = [100, 300, 500, 750, 1000, 1500, 2500],
2328
...baseParams
2429
} = params;

0 commit comments

Comments
 (0)