I have Nuxt JS project. I can’t make a request to the Node js project I run on localhost. It gives Cors error in Network section. I can send requests with Postman, but not from the project. I added the below but my problem is not solved.
axios: {
baseURL: 'http://localhost:3001', // Used as fallback if no runtime config is provided
proxyHeaders: false,
credentials: false
},
>Solution :
I need you to provide me with more details so that I can identify the problem, but in general this problem can be solved by the server side by add
your site host in header Access-Control-Allow-Origin' = '*' you can replace * with you host like if you serve front-end in localhost:3000 you can make it like Access-Control-Allow-Origin' = 'http://localhost:3000'
Examples Uses
app.use(cors({
origin: 'http://yourapp.com'
}));
app.enableCors({
origin: '*'
});