diff --git a/app/api/atproto_images/route.ts b/app/api/atproto_images/route.ts index cb86b1d2..b07ea8c5 100644 --- a/app/api/atproto_images/route.ts +++ b/app/api/atproto_images/route.ts @@ -24,7 +24,7 @@ export async function GET(req: NextRequest) { // Set cache-control header to cache indefinitely cachedResponse.headers.set( "Cache-Control", - "public, max-age=31536000, immutable", + "public, max-age=31536000, immutable, s-maxage=86400, stale-while-revalidate=604800", ); cachedResponse.headers.set( "CDN-Cache-Control", diff --git a/app/lish/[did]/[publication]/atom/route.ts b/app/lish/[did]/[publication]/atom/route.ts index fee6ed89..81b062fb 100644 --- a/app/lish/[did]/[publication]/atom/route.ts +++ b/app/lish/[did]/[publication]/atom/route.ts @@ -19,6 +19,7 @@ export async function GET( return new Response(feed.atom1(), { headers: { "Content-Type": "application/atom+xml", + "Cache-Control": "s-maxage=300, stale-while-revalidate=3600", "CDN-Cache-Control": "s-maxage=300, stale-while-revalidate=3600", }, }); diff --git a/app/lish/[did]/[publication]/icon.ts b/app/lish/[did]/[publication]/icon.ts index f62000bc..deab68cc 100644 --- a/app/lish/[did]/[publication]/icon.ts +++ b/app/lish/[did]/[publication]/icon.ts @@ -59,7 +59,8 @@ export default async function Icon({ headers: { "Content-Type": "image/png", "CDN-Cache-Control": "s-maxage=86400, stale-while-revalidate=86400", - "Cache-Control": "public, max-age=3600", + "Cache-Control": + "public, max-age=3600, s-maxage=86400, stale-while-revalidate=86400", }, }); } catch (e) { diff --git a/app/lish/[did]/[publication]/rss/route.ts b/app/lish/[did]/[publication]/rss/route.ts index e313bb66..6c90b0c6 100644 --- a/app/lish/[did]/[publication]/rss/route.ts +++ b/app/lish/[did]/[publication]/rss/route.ts @@ -19,6 +19,7 @@ export async function GET( return new Response(feed.rss2(), { headers: { "Content-Type": "application/rss+xml", + "Cache-Control": "s-maxage=300, stale-while-revalidate=3600", "CDN-Cache-Control": "s-maxage=300, stale-while-revalidate=3600", }, }); diff --git a/src/utils/getMicroLinkOgImage.ts b/src/utils/getMicroLinkOgImage.ts index 58e690df..4ccf6ece 100644 --- a/src/utils/getMicroLinkOgImage.ts +++ b/src/utils/getMicroLinkOgImage.ts @@ -20,11 +20,16 @@ export async function getMicroLinkOgImage( }, ); const clonedResponse = response.clone(); - if (clonedResponse.status == 200) + if (clonedResponse.status == 200) { clonedResponse.headers.set( "CDN-Cache-Control", "s-maxage=600, stale-while-revalidate=3600", ); + clonedResponse.headers.set( + "Cache-Control", + "s-maxage=600, stale-while-revalidate=3600", + ); + } return clonedResponse; }