Skip to content

Commit

Permalink
Add back cache control headers for CDN caching
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsharp committed Apr 16, 2024
1 parent f870602 commit d201854
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/[username]/feed/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const GET = async (request: Request, { params }: { params: { username: string }

const rssFeed = await getRssFeed(username, hostname, quality);

return new NextResponse(rssFeed);
return new NextResponse(rssFeed, { headers: { "Cache-Control": "s-maxage=300" } });
} catch (errorMessage) {
return new NextResponse((errorMessage as string | undefined) ?? "Unexpected Error", {
status: 500,
Expand Down
4 changes: 3 additions & 1 deletion src/app/videos/[videoId]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const GET = async (request: Request, { params }: { params: { videoId: string } }

const m3u8 = await getStream(videoId, quality);

return new NextResponse(m3u8, { headers: { "Content-Type": "application/x-mpegURL" } });
return new NextResponse(m3u8, {
headers: { "Cache-Control": "s-maxage=600", "Content-Type": "application/x-mpegURL" },
});
} catch (errorMessage) {
return new NextResponse((errorMessage as string | undefined) ?? "Unexpected Error", {
status: 500,
Expand Down

0 comments on commit d201854

Please sign in to comment.