Why am I getting 'RSC' code instead of content after implementing custom headers in my middleware? #82790
Replies: 2 comments 10 replies
-
I guess my first question is, why not use the default Next.js E-Tag behavior? Where's response coming from here? At first I though _rsc query params not being included in middleware could be the issue, but AFAIK, the browser uses full URL to cache these things, so it'd know that it is different content. Could it be a hosting issue? I remember some providers had a very similar this issue when RSC was introduced. |
Beta Was this translation helpful? Give feedback.
-
Context
Cause Fix (minimum viable)
Notes
If this solves it, please Mark as answer so others can find it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Version of Next js - 14.2.23
I have implemented custom headers, including Last-Modified, ETag, and Cache-Control in the middleware. When a page has not been updated, it successfully returns a 304 Not Modified status code.
I retrieve the updated_at timestamp for each page and use it to set the Last-Modified header, generate a hash for the ETag header, and calculate the appropriate value for the Cache-Control header.
However, on certain pages, the content is being replaced with 'RSC' code instead of the expected content.
Beta Was this translation helpful? Give feedback.
All reactions