Repository navigation
feat(analytics): proxy posthog-js capture through /ingest - #26
Pratyay360 merged 3 commits into
Conversation
Add same-origin Vercel rewrites from /ingest to the PostHog US ingest and asset hosts. Set api_host to /ingest and ui_host to the PostHog app. Add a matching Vite dev-server proxy so that local capture continues to work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: 6ec7c1b0-ee13-449c-a6a4-17f92ad9c46b
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: 6ec7c1b0-ee13-449c-a6a4-17f92ad9c46b
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
…thog-js-capture-33a6cc Signed-off-by: PRATYAY MUSTAFI <pratyaymustafi@outlook.com>
Problem
us.i.posthog.com, andvercel.jsonhas no rewrites. Thus no production event goes through a proxy.Origin
signals-scout-generalChanges
/ingeston the site, and Vercel rewrites it to PostHog./ingest/static/*https://us-assets.i.posthog.com/static/*/ingest/array/*https://us-assets.i.posthog.com/array/*(remote config bundle)/ingest/*https://us.i.posthog.com/*vite.config.tsgets a matchingserver.proxy. Without it,vp devwould send capture requests to/ingestand get 404s./ingest. The Vercel rewrites apply before the SvelteKit function runs, andingestis not a locale, sorerouteandhandleI18ndo not change the path.Warning
Vercel bills proxied traffic as Fast Data Transfer and Edge Requests. Current traffic is low, so the cost is small. If session replay volume grows, the PostHog managed reverse proxy has no data transfer cost.
How to verify
vp fmt --checkandvp lintpass on the changed files.vp test run: 9 files, 105 tests pass.vp dev,/ingest/static/array.js,/ingest/array/<token>/config.jsandPOST /ingest/flagsreturn 200 through the proxy./ingest/e/and/ingest/flagsrequests with status 200, and no requests to*.i.posthog.com.Agent context
/ingest/array/*rule in addition to the two rules in the report, because posthog-js loads its remote config from that path.static/llms.txtsymlink (thestatic/skillssubmodule is not checked out). To load the Vite config, I added a temporary local stub. I did not commit it.vp check. Onmain, it already fails on unrelated files, so I ran format and lint on the changed files only.Created with PostHog Desktop from this inbox report.
🤖 Generated with Claude Code