Skip to content

Commit

Permalink
fix: endless capturing /s/
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Nov 25, 2024
1 parent 92bb3e6 commit 02da890
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/extensions/replay/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,15 @@ const POSTHOG_PATHS_TO_IGNORE = ['/s/', '/e/', '/i/']
// because calls to PostHog would be reported using a call to PostHog which would be reported....
const ignorePostHogPaths = (data: CapturedNetworkRequest): CapturedNetworkRequest | undefined => {
const url = convertToURL(data.name)
if (url && url.pathname && POSTHOG_PATHS_TO_IGNORE.some((path) => url.pathname.indexOf(path) === 0)) {
if (
url &&
url.pathname &&
// matches our `/s/` path but also paths within a reverse proxy like `/ingest/s/`
POSTHOG_PATHS_TO_IGNORE.some((path) => url.pathname.indexOf(path) >= 0) &&
// since we're matching `/blah/` loosely, also check a couple of the query params we add
url.search.indexOf('ver=') >= 0 &&
url.search.indexOf('ip=') >= 0
) {
return undefined
}
return data
Expand Down

0 comments on commit 02da890

Please sign in to comment.