I deploy project to vercel by project can’t fetch data show error : GET http://localhost:3000/api/totalReserve net::ERR_BLOCKED_BY_CLIENT
But localhost is work can fetch data
I try to setup next.cofig.mjs to allow cors
/** @type {import('next').NextConfig} */
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: "*" },
{
key: "Access-Control-Allow-Methods",
value: "GET,OPTIONS,PATCH,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",
},
],
},
];
},
images: {
domains: ["images.unsplash.com", "plus.unsplash.com"],
},
};
export default nextConfig;
Advice me please
Try setup config core in file next.config.mjs , setup in file project.json on folder vercel
New contributor
Icewall YaAZ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.