A lightweight reverse proxy for routing PostHog analytics through your own domain. This helps bypass ad blockers and increases event capture rates.
Ad blockers often block requests to posthog.com. By proxying through your own domain, analytics requests appear as first-party traffic and are less likely to be blocked.
The proxy routes requests to PostHog's infrastructure:
/static/*→{region}-assets.i.posthog.com(JS SDK files)/*→{region}.i.posthog.com(events, feature flags, etc.)
This is configured for Fly.io:
fly launch --no-deploy
fly deployThe app will auto-stop when idle and auto-start on incoming requests to minimize costs.
Pushes to main automatically run tests and deploy to Fly.io via GitHub Actions.
To enable automatic deploys, add FLY_API_TOKEN to your repository secrets:
- Generate a token:
fly tokens create deploy -x 999999h - Add it to GitHub: Settings → Secrets and variables → Actions → New repository secret
| Variable | Default | Description |
|---|---|---|
POSTHOG_REGION |
us |
PostHog region: us or eu |
Set the region in fly.toml or via fly secrets set POSTHOG_REGION=eu.
Configure the PostHog SDK to use your proxy:
posthog.init("YOUR_PROJECT_KEY", {
api_host: "https://your-app-name.fly.dev",
ui_host: "https://us.posthog.com", // or eu.posthog.com
});Requires Go 1.22. Use mise to install:
mise install| Command | Description |
|---|---|
make build |
Compile the binary |
make test |
Run tests |
make run |
Run the proxy locally |
make clean |
Remove the built binary |
- Check the health endpoint:
curl https://your-app-name.fly.dev/health - Configure your app's PostHog SDK with the proxy URL
- Verify events appear in your PostHog dashboard