diff --git a/src/app/(menu)/(public)/[username]/posts/[postId]/page.tsx b/src/app/(menu)/(public)/[username]/posts/[postId]/page.tsx index 80a0c69b..5b00e865 100644 --- a/src/app/(menu)/(public)/[username]/posts/[postId]/page.tsx +++ b/src/app/(menu)/(public)/[username]/posts/[postId]/page.tsx @@ -9,7 +9,14 @@ type Params = { params: { username: string; postId: string } }; async function fetchPost(postId: string) { try { - return await postsApi.getPost({ id: postId }); + return await postsApi.getPost( + { id: postId }, + { + next: { + revalidate: 86400, + }, + }, + ); } catch { return undefined; } diff --git a/sst.config.ts b/sst.config.ts index bb83aa4b..18800605 100644 --- a/sst.config.ts +++ b/sst.config.ts @@ -17,7 +17,8 @@ export default { if (stack.stage !== 'production') { domain = `${stack.stage}.${domain}`; } - const serverCachePolicy = new CachePolicy(stack, 'ServerCache', { + // CloudFrontでキャッシュさせたい場合に使用すること + const _serverCachePolicy = new CachePolicy(stack, 'ServerCache', { minTtl: Duration.seconds(86400), defaultTtl: Duration.seconds(86400), headerBehavior: CacheHeaderBehavior.allowList( @@ -41,9 +42,9 @@ export default { NODE_ENV: stack.stage, STAGE: stack.stage, }, - cdk: { - serverCachePolicy, - }, + // cdk: { + // serverCachePolicy, + // }, }); stack.addOutputs({