- Notifications
You must be signed in to change notification settings - Fork 176
Open
Description
My organisation has two projects: one uses basePath
in next.config.js
and the other does not. I noticed that for the project using basePath
, the default cache control header is not showing up for static pages. It shows up for the other project.
I narrowed the header setting down to this check here in fixCacheHeaderForHtmlPages
(ref):
if ( HtmlPages.includes(localizedPath) && !internalEvent.headers["x-middleware-prefetch"] ) { headers[CommonHeaders.CACHE_CONTROL] = "public, max-age=0, s-maxage=31536000, must-revalidate"; }
If I patch the line to include the base path, then it works
HtmlPages.find((path) => `${NextConfig.basePath ?? ""}${path}` === localizedPath)
However, I'm not sure if this is the intended method or if there's a canonical way to treat base paths. If I could be pointed in the right direction, I'd be happy to submit a PR for this.
Metadata
Metadata
Assignees
Labels
No labels