Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Mar 16, 2022
1 parent 5189e8a commit 70ac82e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions docs/going-to-production.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ export async function getServerSideProps({ req, res }) {
```
By default, `Cache-Control` headers will be set differently depending on how your page fetches data.

If the page is using `getServerSideProps` or `getInitialProps`, then it will use the default `Cache-Control` header configured by `next start` in order to prevent accidental caching of responses that cannot be cached.
If the page is using `getServerSideProps` or `getInitialProps`, then it will use the default `Cache-Control` header configured by `next start` in order to prevent accidental caching of responses that cannot be cached. If you want a different cache behavior while using SSR you can use `res.setHeader('Cache-Control', 'value_you_prefer')`.

If the page is using `getStaticProps` or automatic static optimization, then it will have s-maxage=REVALIDATE_SECONDS, stale-while-revalidate or if revalidate is not used s-maxage=31536000, stale-while-revalidate.

If you want a different Cache-Control while using SSR you can use res.setHeader('Cache-Control', 'value_you_prefer').

> **Note:** Your deployment provider must support edge caching for dynamic responses. If you are self-hosting, you will need to add this logic to the edge yourself using a key/value store. If you are using Vercel, [edge caching works without configuration](https://vercel.com/docs/edge-network/caching).
## Reducing JavaScript Size
Expand Down

0 comments on commit 70ac82e

Please sign in to comment.