Following this tutorial: https://vercel.com/support/articles/pointing-subdomains-to-external-services
There are two things here: set A record and CNAME record in Vercel. Should I set both?
If so how should I replace the "example" field for CNAME?
I did for A record, but get an error:
Do I need to set middleware settings in my backend? I was not expected it, as locally I did setup a proxy and it works locally.
app.middleware.use(CORSMiddleware(configuration: .init(
allowedOrigin: .all,//.originBased,
allowedMethods: [.GET, .POST, .PUT, .OPTIONS, .DELETE, .PATCH],
allowedHeaders: [.accept, .authorization, .contentType, .origin, .xRequestedWith, .userAgent, .accessControlAllowOrigin, .init("crossDomain")/*, .accessControlAllowCredentials, .xRequestedWith*/]
)))
// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
async rewrites() {
return [
{
source: "/api/:path*",
destination: `${
process.env.NEXT_PUBLIC_ENVIRONMENT == "PROD"
? process.env.NEXT_PUBLIC_BACKEND_URL
: "http://localhost:8080/"
}:path*`,
},
];
},
};
module.exports = nextConfig;
I tried replace "example" with "api", not possible:
Existing record conflicts..

