Next.js Discord

Discord Forum

Issues with multiple projects under a single domain

Unanswered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
I'm attempting to follow this guide: https://vercel.com/guides/how-can-i-serve-multiple-projects-under-a-single-domain

I'm finding it a bit vague, but perhaps that because I'm new to Vercel.

I'm wanting to deploy all my functions under a single domain api.x.com

From the page I assumed that I have to do something like this.

.
├── vercel-domain-dns-mapping
│   ├── README.md
│   └── vercel.json
├── vercel-example-function
│   ├── README.md
│   ├── api
│   ├── node_modules
│   ├── package.json
│   └── vercel.json


Where vercel-domain-dns-mapping is the vercel.json that has the config file.

{
  "rewrites": [
        {
            "source": "/hello",
            "destination": "vercel-example-function.vercel.app/api/hello"
        },
  ]
}


I assume then I that I have to deploy vercel-domain-dns-mapping as a separate project via cd vercel-domain-dns-mapping && vercel .

But after doing so vercel-domain-dns-mapping project when requested returns

404: NOT_FOUND
Code: DEPLOYMENT_NOT_FOUND
ID: fra1:fra1::cgxd2-1688028280763-b2aabd05a4e8


when curling https://vercel-domain-dns-mapping-810hgp6uv-REDACTED.vercel.app/hello

Why isn't this working? What have I missed?

2 Replies

Masai LionOP
ugh, forgot to add https:// 🤦‍♂️
{
    "$schema": "https://openapi.vercel.sh/vercel.json",
    "rewrites": [
        {
            "source": "/hello",
            "destination": "https://vercel-example-function.vercel.app/api/hello"
        }
    ]
}


works now