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:
Jack Carter
2026-08-03 12:16:12 +02:00
committed by GitHub
parent 7df7793e0f
commit e5da16cee6

View File

@@ -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
{