refactor(api): simplify backend proxy to api and biz paths
This commit is contained in:
@@ -1,5 +1,2 @@
|
|||||||
# Server-only backend origin. Do not expose this as a NEXT_PUBLIC variable.
|
# Server-only backend origin. Do not expose this as a NEXT_PUBLIC variable.
|
||||||
BACKEND_ORIGIN=http://localhost:8000
|
BACKEND_ORIGIN=http://localhost:8000
|
||||||
|
|
||||||
# Browser requests stay on the Next.js origin and are rewritten server-side.
|
|
||||||
NEXT_PUBLIC_API_URL=/backend/
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ const nextConfig: NextConfig = {
|
|||||||
async rewrites() {
|
async rewrites() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: '/backend/:path*',
|
source: '/:namespace(api|biz)/:path*',
|
||||||
destination: `${backendOrigin}/:path*`,
|
destination: `${backendOrigin}/:namespace/:path*`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export const ENV_CONSTANT = {
|
export const ENV_CONSTANT = {
|
||||||
BASE_API_URL: process.env.NEXT_PUBLIC_API_URL,
|
BASE_API_URL: '/',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user