Skip to content

Commit

Permalink
feat(docs): add middleware matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
branko-stripe committed Oct 30, 2024
1 parent 91a4b2c commit 1c8ec2e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions apps/docs/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,22 @@ function getContentSecurityPolicyHeaderValue(nonce: string, reportUri: string):
.map(([key, value]) => `${key} ${value.join(" ")}`)
.join("; ");
}

export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - api (API routes)
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
*/
{
source: "/((?!api|_next/static|_next/image|favicon.ico).*)",
missing: [
{ type: "header", key: "next-router-prefetch" },
{ type: "header", key: "purpose", value: "prefetch" },
],
},
],
};

0 comments on commit 1c8ec2e

Please sign in to comment.