Skip to content

Commit 0e23d4d

Browse files
authored
fix(node-experimental): Ignore OPTIONS & HEAD requests (#9001)
Similar to express, we want to ignore (incoming) OPTIONS & HEAD requests.
1 parent 475c295 commit 0e23d4d

File tree

1 file changed

+10
-0
lines changed
  • packages/node-experimental/src/integrations

1 file changed

+10
-0
lines changed

packages/node-experimental/src/integrations/http.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ export class Http implements Integration {
9898
return isSentryHost(host);
9999
},
100100

101+
ignoreIncomingRequestHook: request => {
102+
const method = request.method?.toUpperCase();
103+
// We do not capture OPTIONS/HEAD requests as transactions
104+
if (method === 'OPTIONS' || method === 'HEAD') {
105+
return true;
106+
}
107+
108+
return false;
109+
},
110+
101111
requireParentforOutgoingSpans: true,
102112
requireParentforIncomingSpans: false,
103113
requestHook: (span, req) => {

0 commit comments

Comments
 (0)