I've just deployed my Strapi API to production following the docs: https://strapi.io/documentation/v3.x/deployment/heroku.html
And by making POST requests from other origins, I get this error:
Since my API works finally on development (localhost to localhost) I presume that the issue is related to CORS, and if it's, that's the cors configuration that I've set on the API:
config/env/production/security.json
:
{
"cors": {
"enabled": true,
"origin": "*"
}
}
config/env/production/middleware.js
:
module.exports = {
settings: {
cors: {
enabled: true,
origin: "*",
},
},
};
I was added the cors config on the development environment...
In order to change the cors config on the production environment, the above code should be placed on the following path:
config/env/production/security.json
config/env/production/middleware.js