why this error shows up?
I’m trying to reach my springboot server using axios. api work well in postman. but in nextjs its not work. how to fix this
const nextConfig = {
async headers() {
return [
{
// matching all API routes
source: "/api/:path*",
headers: [
{ key: "Access-Control-Allow-Credentials", value: "true" },
{ key: "Access-Control-Allow-Origin", value: "*" }, // replace this your actual origin
{ key: "Access-Control-Allow-Methods", value: "GET,DELETE,POST,PUT" },
{ key: "Access-Control-Allow-Headers", value: "X-CSRF-Token, X-Requested-With, Accept, Accept Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" },
]
}
]
},
experimental: {
optimizePackageImports: ['@mantine/core', '@mantine/hooks'],
},
};
export default nextConfig;
this is my next.config.mjs. i add this headers, but nothing change