Note: 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.
Note: If you are using the EU cloud then use
euinstead ofusin all domains (e.g.us.i.posthog.com->eu.i.posthog.com)
If you are using Remix, you can use API routes to set up a reverse proxy.
Create a file ingest.$.tsx in the routes folder. In this file, set up code to match requests to a custom route, set a new host header, change the URL to point to PostHog, and rewrite the response.
Once done, configure the PostHog client to send requests via your rewrite.