-
Notifications
You must be signed in to change notification settings - Fork 162
Open
Description
As I answered in this issue vercel/next.js#56869, adding a custom runtime breaks the dynamic routes when the app is deployed to Vercel.
I found the below solution, in case anyone faces this problem.
Even though this Fast API example doesn't contain dynamic routes, it might still be useful to add { source: "/api/:path*", destination: "/api/:path*" }
to the next config rewrites, like this:
const nextConfig = {
rewrites: async () => {
return [
{
source: "/api/py/:path*",
destination:
process.env.NODE_ENV === "development"
? "http://127.0.0.1:8000/api/py/:path*"
: "/api/",
},
{ source: "/api/:path*", destination: "/api/:path*" },
];
},
};
This will ensure that the dynamic routes don't return 404 when the app is deployed to Vercel.
codeXLinkX and digitros
Metadata
Metadata
Assignees
Labels
No labels