Skip to content

Commit 1c8ec2e

Browse files
committed
feat(docs): add middleware matcher
1 parent 91a4b2c commit 1c8ec2e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

apps/docs/src/middleware.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,22 @@ function getContentSecurityPolicyHeaderValue(nonce: string, reportUri: string):
7777
.map(([key, value]) => `${key} ${value.join(" ")}`)
7878
.join("; ");
7979
}
80+
81+
export const config = {
82+
matcher: [
83+
/*
84+
* Match all request paths except for the ones starting with:
85+
* - api (API routes)
86+
* - _next/static (static files)
87+
* - _next/image (image optimization files)
88+
* - favicon.ico (favicon file)
89+
*/
90+
{
91+
source: "/((?!api|_next/static|_next/image|favicon.ico).*)",
92+
missing: [
93+
{ type: "header", key: "next-router-prefetch" },
94+
{ type: "header", key: "purpose", value: "prefetch" },
95+
],
96+
},
97+
],
98+
};

0 commit comments

Comments
 (0)