Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

instrument-reverse-proxy

FreeNo executable scriptsNot checked

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…

PostHogby PostHog★ 81 GitHub stars

About 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 reference
  • references/cloudflare.md - Cloudflare reverse proxy
  • references/vercel.md - Vercel reverse proxy
  • references/nextjs.md - Next.js rewrites reverse proxy
  • references/nextjs-middleware.md - Next.js proxy file reverse proxy
  • references/netlify.md - Netlify reverse proxy
  • references/nuxt.md - Nuxt reverse proxy
  • references/sveltekit.md - Sveltekit reverse proxy
  • references/remix.md - Remix reverse proxy
  • references/node.md - Node reverse proxy
  • references/railway.md - Railway reverse proxy
  • references/nginx.md - Nginx reverse proxy
  • references/caddy.md - Caddy reverse proxy
  • references/cloudfront.md - Aws cloudfront reverse proxy
  • references/kubernetes-ingress-controller.md - Kubernetes reverse proxy
  • references/pomerium.md - Pomerium reverse proxy
  • references/proxy.md - Deploy a reverse proxy
  • references/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 its id and the target_cname for 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_host and ui_host. Check the env files and the hosting configuration that set them too.
  • If api_host already points at a domain or a path of the app, a
Full SKILL.md on GitHub

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
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

references/COMMANDMENTS.mdreferences/caddy.mdreferences/cloudflare.mdreferences/cloudfront.mdreferences/kubernetes-ingress-controller.mdreferences/netlify.mdreferences/nextjs-middleware.mdreferences/nextjs.mdreferences/nginx.mdreferences/node.mdreferences/nuxt.mdreferences/pomerium.mdreferences/proxy-reference.mdreferences/proxy.mdreferences/railway.mdreferences/remix.mdreferences/sveltekit.mdreferences/vercel.md

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

Compare instrument-reverse-proxy with