instrument-reverse-proxy
FreeNo executable scriptsNot checkedRoute PostHog's browser traffic through the app's own domain, so ad blockers don't drop events, session replays, and feature flag calls. Use when the user…
by PostHog★ 81 GitHub starsAbout this skill
Set up a PostHog reverse proxy
Use this skill to route the PostHog browser SDK's traffic through a domain the app owns. Ad blockers keep lists of analytics domains and block requests to them. Through a proxy, events, session replay data, feature flag calls, surveys, and the SDK's own scripts load from the app's domain, so ad blockers don't drop them.
A proxy is optional, and setting one up can take several steps the user has to do themselves, such as a DNS record. Set one up only when the user asked for it or agreed to your suggestion.
This skill covers the browser SDK: posthog-js and the snippet. Server-side SDKs don't need a proxy, so don't add one for them.
There are two ways to do it:
- A self-hosted proxy. A rewrite, edge function, or server route in the app's own hosting forwards a path, such as
/e, to PostHog. On platforms with built-in rewrites or edge functions, it's a few lines of configuration. - PostHog's managed reverse proxy. The user adds one DNS record for a subdomain, such as
e.example.com, and PostHog runs the proxy, its TLS certificate, and its routing. It's free on PostHog Cloud, and no proxy code goes into the app.
Trade-offs
| Self-hosted proxy | Managed proxy | |
|---|---|---|
| Setup | Code or config in the app, deployed with it. No DNS change. | One CNAME record. Needs DNS access and an organization admin. |
| Blocking | A path on the app's own domain has no CNAME, so DNS-level blockers (NextDNS, Pi-hole) can't trace it back to PostHog. | DNS-level blockers that uncloak CNAMEs can see the record points at PostHog. Browser extensions can't. |
| Cost | Requests count against the platform's bandwidth and invocation quotas. Vercel, Netlify, CloudFront, and Railway bill for them, which adds up on high-traffic sites. | Free. Doesn't touch the app's hosting quotas. |
| Maintenance | The app owns it: routing, headers, body size limits. PostHog support can't troubleshoot it. | PostHog maintains it and offers a proxy-diagnose check. |
| Compliance | Runs wherever the app runs. Works for HIPAA and EU-only edge requirements. | Runs on Cloudflare, a PostHog subprocessor. Not HIPAA-compliant, and EU edge termination isn't guaranteed. |
| Availability | Any PostHog, including self-hosted. | PostHog Cloud only. An organization gets a limited number of proxies (proxy-list returns the limit). |
Reference files
references/proxy-reference.md- Self-hosted proxy referencereferences/cloudflare.md- Cloudflare reverse proxyreferences/vercel.md- Vercel reverse proxyreferences/nextjs.md- Next.js rewrites reverse proxyreferences/nextjs-middleware.md- Next.js proxy file reverse proxyreferences/netlify.md- Netlify reverse proxyreferences/nuxt.md- Nuxt reverse proxyreferences/sveltekit.md- Sveltekit reverse proxyreferences/remix.md- Remix reverse proxyreferences/node.md- Node reverse proxyreferences/railway.md- Railway reverse proxyreferences/nginx.md- Nginx reverse proxyreferences/caddy.md- Caddy reverse proxyreferences/cloudfront.md- Aws cloudfront reverse proxyreferences/kubernetes-ingress-controller.md- Kubernetes reverse proxyreferences/pomerium.md- Pomerium reverse proxyreferences/proxy.md- Deploy a reverse proxyreferences/COMMANDMENTS.md- Framework-specific rules the integration must follow
The overview reference covers the managed proxy: its steps, troubleshooting, and FAQ. Each platform reference shows a self-hosted proxy for one platform. When this page and a reference disagree on a platform's configuration, follow the reference.
API tools
The managed proxy steps use PostHog API tools. The same tool names work through the PostHog MCP server (its exec tool) and through the hog CLI (hog api call <tool> '<json input>').
proxy-list: the organization's proxies, with their status, and the most the plan allows.proxy-create: creates a proxy for a domain. Returns itsidand thetarget_cnamefor the DNS record.proxy-get: one proxy's status and message.proxy-diagnose: checks DNS, CAA records, the certificate, and a live event, and says how to fix each failure.proxy-retry: starts provisioning again after the user fixed the problem.
Proxies belong to the organization, not the project, and only organization admins can create, retry, diagnose, or delete them. The token needs the organization:write scope. With the hog CLI, run hog auth add organization:write and ask the user to approve it in the browser. If PostHog rejects the call because the user isn't an admin, give the steps to an admin, or use a self-hosted proxy instead.
Instructions
Follow these steps IN ORDER:
STEP 1: Check what the app already has.
- Find where the app initializes posthog-js and read its
api_hostandui_host. Check the env files and the hosting configuration that set them too. - If
api_hostalready points at a domain or a path of the app, a
Install instrument-reverse-proxy in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the instrument-reverse-proxy skill do?
Route PostHog's browser traffic through the app's own domain, so ad blockers don't drop events, session replays, and feature flag calls. Use when the user asks for a reverse proxy or agrees to one you suggested, for example after adding posthog-js or when events or recordings seem to be missing. Don't set one up unprompted. Prefers a self-hosted proxy where the app's platform makes it a small change, such as Next.js or Cloudflare, and PostHog's managed reverse proxy elsewhere.
How do I install the instrument-reverse-proxy skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the instrument-reverse-proxy skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic