Skip to content

PostHog Reverse Proxy #21

@evanjacobson

Description

@evanjacobson

Integration: Inline PostHog snippet in public/posthog.js:49, loaded globally via astro.config.mjs. src/components/PostHogScript.astro is a never-imported duplicate — can be deleted. This is a static Astro site with no SSR adapter, deployed on Vercel.

Since Astro static sites have no server-side rewrite capability, use Vercel rewrites which run at the CDN/edge layer without needing an adapter:

  1. Create vercel.json at the project root:
{
  "rewrites": [
    { "source": "/ingest/static/:path*", "destination": "https://us-assets.i.posthog.com/static/:path*" },
    { "source": "/ingest/:path*",        "destination": "https://us.i.posthog.com/:path*" }
  ]
}
  1. Update public/posthog.js — change api_host and add ui_host:
posthog.init("phc_...", {
  api_host: "https://path.kilo.ai/ingest",
  ui_host: "https://us.posthog.com",
  // ...
});
  1. Delete src/components/PostHogScript.astro — dead code, never imported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions