18 lines
500 B
TypeScript
18 lines
500 B
TypeScript
import { NextResponse } from 'next/server'
|
|
import type { NextRequest } from 'next/server'
|
|
|
|
export function middleware(request: NextRequest) {
|
|
// Allow API routes to be accessed publicly
|
|
if (request.nextUrl.pathname.startsWith('/api/')) {
|
|
const response = NextResponse.next()
|
|
response.headers.set('x-vercel-protection-bypass', process.env.VERCEL_AUTOMATION_BYPASS_SECRET || '')
|
|
return response
|
|
}
|
|
|
|
return NextResponse.next()
|
|
}
|
|
|
|
export const config = {
|
|
matcher: '/api/:path*',
|
|
}
|