next.js
16bfce64 - [Segment Cache] Respond with 204 on cache miss (#73649)

Commit
1 year ago
[Segment Cache] Respond with 204 on cache miss (#73649) Currently, when the client prefetches a segment, the server responds with a 404 if it cannot fulfill the request. This updates it to respond with a 204 No Content instead, since it's not an error for the client to request a segment whose prefetch hasn't been generated. When responding with 204, the server also sends the 'x-nextjs-postponed' header, but only if PPR is enabled for the route. The client can use the absence of this header to distinguish between a regular cache miss and a miss due to PPR being disabled. In a later PR, I will update the client to use this information to fall back to the non-PPR behavior.
Author
Parents
Loading