Using Vercel rewrites as a reverse proxy

Last updated:

Vercel supports rewrites which we can use as a reverse proxy. Create a vercel.json file and add a rewrites object from the /ingest route to or

"rewrites": [
"source": "/ingest/:match*",
"destination": "*"

Once done, set the /ingest route of your domain as the API host in your PostHog initialization like this:

api_host: '',

Once updated, deploy your changes on Vercel and check that PostHog requests are going to by checking the network tab on your domain.

Setup video


Was this page useful?

Next article

Product analytics for browser extensions

Do you have a Firefox or Chrome browser plugin with a user interface and want to understand how it's being used? PostHog is the perfect way to do just that. Setup for Firefox & Chrome plugins Installing PostHog inside your plugin Open the HTML file used in your default_popup and add the PostHog array.js script. To do this you'll need to either: Copy the latest version of array.js from: and import it locally using <script src="array.js" /> before…

Read next article