Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: now the dev card page is cached for one hour #3968

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pages/u/[username]/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
const uniqueUsernames = [...new Set([username, ...ADDITIONAL_PROFILES_TO_LOAD])];
const cards = await Promise.all(uniqueUsernames.map(fetchUserData));

// Cache page for one hour
context.res.setHeader("Cache-Control", "public, max-age=0, must-revalidate");
context.res.setHeader("Netlify-CDN-Cache-Control", "public, max-age=0, stale-while-revalidate=3600");
context.res.setHeader("Cache-Tag", `user-profiles,user-profile-${username}`);

return {
props: {
username,
Expand Down
Loading