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

Update the cache-control section of the documentation with Next 11+ defaults #34999

Closed
TheHacker66 opened this issue Mar 3, 2022 · 2 comments

Comments

@TheHacker66
Copy link

The Cache-Control header set by next start is correct, as it prevents accidental caching of responses that can't be cached by default. If the page uses SSR (getServerSideProps/getInitialProps) it will have the mentioned cache control header. If it's using SSG (getStaticProps or automatic static optimization) 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') and Next.js will keep it as-is in production. In development te Cache-Control header is overwritten to ensure every request is not cached.

Originally posted by @timneutkens in #33204 (comment)

@balazsorban44
Copy link
Member

Duplicate of #33210

@balazsorban44 balazsorban44 marked this as a duplicate of #33210 Mar 3, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 3, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants