Repository navigation
feat(analytics): proxy posthog-js capture through /ingest - #26
Draft
posthog[bot] wants to merge 2 commits into
Draft
posthog[bot] wants to merge 2 commits into
posthog[bot] wants to merge 2 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
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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