The following self-hosted proxy isn't provided by PostHog, so we can't take responsibility for it! If unsure, we recommend using our managed reverse proxy.
If you are using the EU cloud then use
eu
instead ofus
in all domains (e.g.us.i.posthog.com
->eu.i.posthog.com
).Avoid using generic or common path names like
/analytics
,/tracking
,/ingest
, or/posthog
for your reverse proxy. They will most likely be blocked. Instead, use a non-obvious path name or something random and unique to your application that's unlikely to appear in a filter list.
Railway provides a simple way to deploy a reverse proxy for PostHog. Click the button below to deploy a reverse proxy on Railway:
Make sure to set the POSTHOG_CLOUD_REGION
variable to either us
or eu
depending on your PostHog cloud region.
Afterwards, configure your PostHog client to send requests through your reverse proxy.
posthog.init('<ph_project_api_key>', {api_host: 'https://your-project-name.up.railway.app', // Your Railway domainui_host: 'https://us.posthog.com', // Or https://eu.posthog.com depending on your cloud region.})