fix: next js bug
This commit is contained in:
parent
996eafd0cb
commit
4db90f57df
1 changed files with 7 additions and 12 deletions
|
|
@ -1,24 +1,19 @@
|
||||||
import { NextResponse } from 'next/server'
|
import { NextResponse } from 'next/server'
|
||||||
import type { NextRequest } from 'next/server'
|
import type { NextRequest } from 'next/server'
|
||||||
|
|
||||||
|
// next js bug
|
||||||
export function middleware(request: NextRequest) {
|
export function middleware(request: NextRequest) {
|
||||||
if (request.method === 'POST') {
|
if (request.method === 'POST') {
|
||||||
console.log('[Middleware] POST request received', {
|
if (!request.headers.has('next-action')) {
|
||||||
path: request.nextUrl.pathname,
|
console.log('[Middleware] Blocked POST without Next-Action header')
|
||||||
method: request.method,
|
return new NextResponse('Method Not Allowed', { status: 405 })
|
||||||
contentType: request.headers.get('content-type'),
|
}
|
||||||
userAgent: request.headers.get('user-agent'),
|
|
||||||
referer: request.headers.get('referer'),
|
|
||||||
nextAction: request.headers.get('next-action'),
|
|
||||||
accept: request.headers.get('accept'),
|
|
||||||
protocol: request.headers.get('x-forwarded-proto'),
|
|
||||||
ip: request.headers.get('x-forwarded-for'),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.next()
|
return NextResponse.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
matcher: ['/kontakt'],
|
// All pages with contact forms — exclude /api and /admin (Payload CMS)
|
||||||
|
matcher: ['/((?!api|admin|_next/static|_next/image|favicon.ico).*)'],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue