File size: 452 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Ensure that https://github.com/vercel/next.js/issues/56286 is fixed.
import { NextResponse } from 'next/server'

export async function middleware(req) {
  if (req.nextUrl.pathname.includes('rewrite-to-static-first')) {
    req.nextUrl.pathname = '/static/first'
    return NextResponse.rewrite(req.nextUrl)
  }

  return NextResponse.next()
}

/**
 * @type {import('next/server').MiddlewareConfig}
 */
export const config = {
  runtime: 'nodejs',
}