-
Notifications
You must be signed in to change notification settings - Fork 28.6k
feat(etag-test): restore ETag behavior for static pre-rendered page #80490
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
base: canary
Are you sure you want to change the base?
feat(etag-test): restore ETag behavior for static pre-rendered page #80490
Conversation
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example: | ||
npx create-next-app --example etag-test etag-test-app | ||
```bash | ||
npx create-next-app --example hello-world hello-world-app |
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.
There appears to be a copy-paste error in the README.md installation instructions. The command references hello-world
instead of etag-test
:
npx create-next-app --example hello-world hello-world-app
This should be corrected to:
npx create-next-app --example etag-test etag-test-app
to ensure users install the correct example when following the documentation.
npx create-next-app --example hello-world hello-world-app | |
npx create-next-app --example etag-test etag-test-app |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
For Contributors
Adding or Updating Examples
pnpm build && pnpm lint
What?
This PR adds an example under
examples/etag-test
that demonstrates how to restore ETag support for static pre-rendered pages in Next.js 15, and how the behavior compares to Next.js 14.Why?
Starting with Next.js 15, React Server Components (RSC) are streamed by default, which disables automatic ETag headers on static responses.
Many developers upgrading from v14 expect 304 caching to work, but observe 200s instead.
This example helps validate and test that behavior explicitly.
How?
etag-test
example with a static route (pages/index.tsx
)curl
withIf-None-Match
to confirm 304 Not Modified responseFixes: #80452
Example path:
examples/etag-test
Works in:
To test:
pnpm install pnpm build pnpm start curl -I http://localhost:3000/ curl -I -H 'If-None-Match: "<etag-value>"' http://localhost:3000/