instrument-reverse-proxy
Installation
SKILL.md
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.