Skip to content

Commit a863957

Browse files
committed
fix(docs): use greedy regex for PostHog reverse proxy rewrites
Vercel's :path* wildcard fails on URLs with trailing slashes like /ph/e/?compression=gzip-js, silently dropping PostHog event payloads. Using :match(.*) matches the full path including trailing slashes.
1 parent ad5da5c commit a863957

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

docs/next.config.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ const config = {
1414
},
1515

1616
// PostHog reverse proxy (path intentionally non-obvious to avoid ad-blocker filter lists)
17+
// Uses :match(.*) instead of :path* to handle trailing slashes in PostHog URLs
1718
{
18-
source: '/ph/static/:path*',
19-
destination: 'https://us-assets.i.posthog.com/static/:path*',
19+
source: '/ph/static/:match(.*)',
20+
destination: 'https://us-assets.i.posthog.com/static/:match',
2021
},
2122
{
22-
source: '/ph/:path*',
23-
destination: 'https://us.i.posthog.com/:path*',
23+
source: '/ph/:match(.*)',
24+
destination: 'https://us.i.posthog.com/:match',
2425
},
2526
];
2627
},

0 commit comments

Comments
 (0)