-
Notifications
You must be signed in to change notification settings - Fork 27k
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
/manifest.webmanifest not cached by browser and reloaded on every page transition #64864
Comments
Yeah, I can reproduce this exact problem. Is there any workaround for this? |
I ran into this as well. Similar to @cbratschi I tried forcing it via middleware:
|
Also having this issue. This does not solely apply to manifest routes, all metadata routes are affected. Sitemap and robots display the same bugs. |
This was referenced Sep 17, 2024
ijjk
added a commit
that referenced
this issue
Sep 23, 2024
…fied by user (#70127) Fixes #70086 and #64864 (partially) ### What? When user wants to override for certain headers such as `content-type` or `cache-control` via `next.config` file or through middleware, nextjs sends multiple header values by combining the user's headers with its own default values for such headers. An example is demonstrated here: https://github.com/user-attachments/assets/7b38331b-9137-485d-9285-d0b0d0e1e5ac ### Why? Duplicate header values are a problem. ### How? Maintaining a list of headers which cannot have duplicate values, and then checking if the user has overridden any of those headers. If so, user overrides are respected and sent over. Demonstration of the correct behaviour after this fix: Using `next.config` file: https://github.com/user-attachments/assets/65e2aafb-dffc-47f4-bfcf-cf26a66865db Using `middleware`: https://github.com/user-attachments/assets/67636145-10eb-4504-ad78-800c1307c550 --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Link to the code that reproduces this issue
https://github.com/cbratschi/nextjs-issues/tree/manifest
To Reproduce
Current vs. Expected behavior
Ideally a hash would be added to the manifest URL (current first):
This allows using immutable versions of the manifest.
In addition the cache-control value should be modified (current first):
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:37 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6031 Available memory (MB): 65536 Available CPU cores: 16 Binaries: Node: 20.11.1 npm: 10.2.4 Yarn: 1.22.21 pnpm: N/A Relevant Packages: next: 14.2.2 // Latest available version is detected (14.2.2). eslint-config-next: 14.2.2 react: 18.2.0 react-dom: 18.2.0 typescript: 5.4.5 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Metadata
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)
Additional context
I tried to set cache-control in next.config.js to get at least a max-age of one hour but ended with two cache-control headers being returned:
The text was updated successfully, but these errors were encountered: