Home About Me

Using Vercel or Netlify as a Reverse Proxy for Your Site

If you already have a site running on an IP address and port, or behind another domain, you can put Vercel or Netlify in front of it and use either platform as a reverse proxy. The setup is short: add a small config file to an empty repository, connect that repository to the platform, and let the platform handle the routing.

Vercel

Start with an empty repository and add a file named vercel.json:

{
    "version": 2,
    "routes": [
      {"src": "/(.*)","dest": "{url}/$1"}
    ]
}

Replace {url}/$1 with your own IP plus port or domain. For example, http://1.2.3.4:8080/$1 or https://apple.com/$1.

Create a Vercel project connected to this repository and deploy it. After a short wait, usually tens of seconds, Vercel will route requests through to your site.

You can also push the project to Vercel with the CLI.

Once it is working, bind your domain in Vercel. If access feels slow, you can change the CNAME record to a faster Vercel CDN endpoint.

Netlify

Netlify uses almost the same approach. In an empty repository, create netlify.toml:

[[redirects]]
  from = "/*"
  to = "{url}/:splat"
  status = 200
  force = true

Replace {url}/:splat with your IP and port, such as http://1.2.3.4:8080/:splat.