I have the following nextjs middleware.ts config file,
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)
* - fonts (font files)
*/
'/((?!_next/image|_next/static|api|favicon.ico|fonts).*)',
],
};
Optimize next image url:-
https://{vercel_stage_server_domain}/_next/image?url=
Optimize next image url in local:-
http://localhost:3000/_next/image?url=
Works fine in local, but nor work in stage server, In stage server it redirect.
How can I prevent the redirection?