diff --git a/apps/web/app/storage/[environmentId]/[accessType]/[fileName]/lib/get-file.ts b/apps/web/app/storage/[environmentId]/[accessType]/[fileName]/lib/get-file.ts index 73be4632f7..cfdebe5bbb 100644 --- a/apps/web/app/storage/[environmentId]/[accessType]/[fileName]/lib/get-file.ts +++ b/apps/web/app/storage/[environmentId]/[accessType]/[fileName]/lib/get-file.ts @@ -19,7 +19,7 @@ export const getFile = async ( headers: { "Content-Type": metaData.contentType, "Content-Disposition": "attachment", - "Cache-Control": "public, max-age=1200, s-maxage=1200, stale-while-revalidate=300", + "Cache-Control": "public, max-age=300, s-maxage=300, stale-while-revalidate=300", Vary: "Accept-Encoding", }, }); @@ -35,10 +35,7 @@ export const getFile = async ( status: 302, headers: { Location: signedUrl, - "Cache-Control": - accessType === "public" - ? `public, max-age=3600, s-maxage=3600, stale-while-revalidate=300` - : `public, max-age=600, s-maxage=3600, stale-while-revalidate=300`, + "Cache-Control": "public, max-age=300, s-maxage=300, stale-while-revalidate=300", }, }); } catch (error: unknown) { diff --git a/packages/lib/storage/service.ts b/packages/lib/storage/service.ts index fc0ea94dd8..371aa97f1c 100644 --- a/packages/lib/storage/service.ts +++ b/packages/lib/storage/service.ts @@ -104,9 +104,6 @@ type TGetSignedUrlResponse = }; const getS3SignedUrl = async (fileKey: string): Promise => { - const [_, accessType] = fileKey.split("/"); - const expiresIn = accessType === "public" ? 60 * 60 : 10 * 60; - const getObjectCommand = new GetObjectCommand({ Bucket: S3_BUCKET_NAME, Key: fileKey, @@ -114,7 +111,7 @@ const getS3SignedUrl = async (fileKey: string): Promise => { try { const s3Client = getS3Client(); - return await getSignedUrl(s3Client, getObjectCommand, { expiresIn }); + return await getSignedUrl(s3Client, getObjectCommand, { expiresIn: 30 * 60 }); } catch (err) { throw err; }