Hello!
I’m new to the forums and, in general, fairly new to strapi. I could use a bit of help getting my website to talk to strapi properly.
I’m working on a new iteration of my website which uses strapi. I’m having some issues with CORS:
From what I’ve read, I’m supposed to configure strapi::cors like this:
middlewares.js
module.exports = [
'strapi::errors',
'strapi::security',
'strapi::poweredBy',
{
name: 'strapi::cors',
config: {
origin: ['https://japanesecooking.com', 'https://www.japanesecooking.com'],
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'],
headers: ['Content-Type', 'Authorization', 'Origin', 'Accept'],
keepHeaderOnError: true,
},
},
'strapi::logger',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
];
I’ve also tried wildcards for the origin, like this:
module.exports = [
'strapi::errors',
'strapi::security',
{
name: 'strapi::cors',
config: {
origin: ['*'],
methods: ['*'],
headers: ['*']
},
},
'strapi::poweredBy',
'strapi::logger',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
];
But the cors error is still there. Any suggestions?