mirror of
https://github.com/netbirdio/docs.git
synced 2026-08-24 16:51:26 +02:00
fix: serve page props for API docs on client-side navigation (#900)
The /ipa/:path* -> /api/:path* redirect also matched Next.js data requests (/_next/data/.../ipa/...), returning a 308 instead of page props. Client-side navigations to API pages therefore lost pageProps, leaving the sidebar method list collapsed and the tab title undefined until a full reload. Skip the redirect when the x-nextjs-data header is present so props fetches go through; browser visits to /ipa/* still get the canonical redirect to /api/*.
This commit is contained in:
@@ -103,7 +103,16 @@ const nextConfig = {
|
||||
{
|
||||
source: '/ipa/:path*',
|
||||
destination: '/api/:path*',
|
||||
permanent: true
|
||||
permanent: true,
|
||||
// Client-side navigations fetch page props from
|
||||
// /_next/data/<buildId>/ipa/... — redirecting those requests
|
||||
// strips pageProps (title, sections), so skip data requests.
|
||||
missing: [
|
||||
{
|
||||
type: 'header',
|
||||
key: 'x-nextjs-data',
|
||||
},
|
||||
],
|
||||
},
|
||||
// documentation redirects for about
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user