Hello,
I have two nextjs applications and I want to run them on the same IP address. The first application on http://IP
and the second application on http://IP/branch
. The Next.config.js
and callApi.js
files for both applications are as follows:
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
eslint: {
ignoreDuringBuilds: true,
},
};
module.exports = nextConfig;
And:
const callApi = () => {
const axiosInstance = axios.create({
baseURL: '/api',
withCredentials: true,
headers: {
'Content-Type': 'application/json',
},
});
And:
// next.config.js
module.exports = {
basePath: '/branch',
assetPrefix: '/branch',
async rewrites() {
return [
{
source: '/branch/_next/:path*',
destination: '/_next/:path*'
},
{
source: '/branch',
destination: '/branch'
}
]
}
}
And:
const callApi = () => {
const axiosInstance = axios.create({
baseURL: `/api/branch`,
withCredentials: true,
headers: {
'Content-Type': 'application/json',
},
});
Is everything OK?
Thank you.