Next.js Discord

Discord Forum

Having problem with Vercel Rewrites

Unanswered
Rhinelander posted this in #help-forum
Open in Discord
RhinelanderOP
Using turborepo "/apps/cms" - here lives my Payload instance. I changed default /admin path to /cms and when i work locally i want to access it via localhost:3000/cms/login and when i push prod i want to access it cms.example.vercel.app (later add my own domain so cms.example.com/login) as far as i understand for local development i don't need to worry about as vercel.json doesn't make impact for prod i think this json is correct i rewrite anything starting wtih /cms/:path to just path and later i add cms. to my domain


My vercel.json file
{
    "rewrites": [
        {
            "source": "/cms/:path*",
            "destination": "/:path*"
        },
        {
            "source": "/:path*",
            "destination": "/:path*",
            "has": [
                {
                    "type": "host",
                    "value": "cms.(?<domain>.*)"
                }
            ]
        }
    ]
}

0 Replies