next.js/test/e2e/middleware-matcher/app/middleware.js
middleware.js18 lines400 B
import { NextResponse } from 'next/server'

export const config = {
  matcher: [
    '/',
    '/with-middleware/:path*',
    '/another-middleware/:path*',
    // the below is testing special characters don't break the build
    '/_sites/:path((?![^/]*\\.json$)[^/]+$)',
  ],
}

export default (req) => {
  const res = NextResponse.next()
  res.headers.set('X-From-Middleware', 'true')
  return res
}
Quest for Codev2.0.0
/
SIGN IN