Repository navigation
Next.js config redirect cache-control/headers #99831
flippidippi
started this conversation in
Ideas
Replies: 1 comment
|
Another way to do this would be to instead of doing Might look something like this in a user's config if they want to do this async headers () {
const existingHeaders = await config.headers?.() ?? []
const permanentRedirectHeaders = getUrlRedirects()
.filter((redirect) => redirect.permanent === true)
.map(({ destination, permanent, ...redirect }) => ({
...redirect,
headers: [
{ key: 'Cache-Control', value: 'private, max-age=86400' }
]
}))
return [...existingHeaders, ...permanentRedirectHeaders]
} |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Goals
Non-Goals
Background
It would make the redirect config in Next.js more flexible and not require work arounds.
Proposal
Allow sets a header key on a Next.js config
Redirectin addition to the existingsource,destination,permanent, etc.This would allow devs to set stuff like
Cache-Controlto tell browsers how long a permanent redirect should be cached for.All reactions