File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -99,8 +99,14 @@ export async function middleware(request: NextRequest) {
9999 }
100100
101101 const userAgent = request . headers . get ( 'user-agent' ) || ''
102+
103+ // Check if this is a webhook endpoint that should be exempt from User-Agent validation
104+ const isWebhookEndpoint = url . pathname . startsWith ( '/api/webhooks/trigger/' )
105+
102106 const isSuspicious = SUSPICIOUS_UA_PATTERNS . some ( ( pattern ) => pattern . test ( userAgent ) )
103- if ( isSuspicious ) {
107+
108+ // Block suspicious requests, but exempt webhook endpoints from User-Agent validation only
109+ if ( isSuspicious && ! isWebhookEndpoint ) {
104110 logger . warn ( 'Blocked suspicious request' , {
105111 userAgent,
106112 ip : request . headers . get ( 'x-forwarded-for' ) || 'unknown' ,
You can’t perform that action at this time.
0 commit comments