Skip to content

Commit

Permalink
fix: only add cache tags when they're available
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattjoh committed May 30, 2023
1 parent f32fe81 commit f3d0754
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1720,9 +1720,11 @@ export default abstract class Server<ServerOptions extends Options = Options> {
return cacheEntry
}

// The response headers here are immutable, but we can set it
// directly on the node response here instead.
res.setHeader('x-next-cache-tags', cacheTags)
if (cacheTags) {
// The response headers here are immutable, but we can set it
// directly on the node response here instead.
res.setHeader('x-next-cache-tags', cacheTags)
}

// Send the response now that we have copied it into the cache.
await sendResponse(req, res, response)
Expand Down

0 comments on commit f3d0754

Please sign in to comment.