-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[examples] Fix ssr-caching example. (#26540)
Closes #12019 with a better example of proper SSR caching.
- Loading branch information
Showing
5 changed files
with
39 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
import Link from 'next/link' | ||
|
||
export default function Home() { | ||
export default function Index({ time }) { | ||
return ( | ||
<ul> | ||
<li> | ||
<Link href="/blog?id=first" as="/blog/first"> | ||
<a>My first blog post</a> | ||
</Link> | ||
</li> | ||
<li> | ||
<Link href="/blog?id=second" as="/blog/second"> | ||
<a>My second blog post</a> | ||
</Link> | ||
</li> | ||
<li> | ||
<Link href="/blog?id=last" as="/blog/last"> | ||
<a>My last blog post</a> | ||
</Link> | ||
</li> | ||
</ul> | ||
<main> | ||
<h1>SSR Caching with Next.js</h1> | ||
<time dateTime={time}>{time}</time> | ||
</main> | ||
) | ||
} | ||
|
||
export async function getServerSideProps({ req, res }) { | ||
res.setHeader( | ||
'Cache-Control', | ||
'public, s-maxage=10, stale-while-revalidate=59' | ||
) | ||
|
||
return { | ||
props: { | ||
time: new Date().toISOString(), | ||
}, | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
f6e5a81
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi everyone!
Could someone please help me figuring out how to configure this technique to work with proxy-caching, specifically with Nginx caching?
Please, take a look at my stackoverflow question, in which I described the problem in details.
Thanks in advance!