{"record":{"id":"45a2d9ef478b0350","repo":"vercel/next.js","slug":"warning-custom-cache-control-headers-detected-for","errorCode":null,"errorMessage":"Warning: Custom Cache-Control headers detected for the following routes:\n  - ${source}\n\nSetting a custom Cache-Control header can break Next.js development behavior.","messagePattern":"Warning: Custom Cache-Control headers detected for the following routes:\n  - (.+?)\n\nSetting a custom Cache-Control header can break Next\\.js development behavior\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/load-custom-routes.ts","lineNumber":745,"sourceCode":"        `redirects: ${redirects.length}\\n` +\n        `See more info: https://nextjs.org/docs/messages/max-custom-routes-reached`\n    )\n  }\n\n  const cacheControlSources: string[] = []\n  for (const headerRoute of headers) {\n    if (!headerRoute.source.startsWith('/_next/')) {\n      continue\n    }\n    for (const header of headerRoute.headers) {\n      if (header.key.toLowerCase() === 'cache-control') {\n        cacheControlSources.push(headerRoute.source)\n        break\n      }\n    }\n  }\n  if (cacheControlSources.length > 0) {\n    console.warn(\n      bold(yellow(`Warning: `)) +\n        `Custom Cache-Control headers detected for the following routes:\\n` +\n        cacheControlSources.map((source) => `  - ${source}`).join('\\n') +\n        `\\n\\nSetting a custom Cache-Control header can break Next.js development behavior.`\n    )\n  }\n\n  if (config.deploymentId) {\n    if (config.experimental?.useSkewCookie) {\n      headers.unshift({\n        source: '/:path*',\n        headers: [\n          {\n            key: 'Set-Cookie',\n            value: `__vdpl=${config.deploymentId}; Path=/; HttpOnly`,\n          },\n        ],\n      })","sourceCodeStart":727,"sourceCodeEnd":763,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/lib/load-custom-routes.ts#L727-L763","documentation":"loadCustomRoutes scans header routes and warns when a custom Cache-Control header is set on a /_next/* source; such headers can break Next.js's own asset caching behavior (especially in development), so the offending route sources are listed for removal.","triggerScenarios":"Thrown at packages/next/src/lib/load-custom-routes.ts:745 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove custom Cache-Control headers for these routes in development, or scope them to production only."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}