dsolay
1
System Information
-
Strapi Version: 4.0
-
Operating System: ArchLinux Kernel 5.15.6
-
Database: Postgresql
-
Node Version: 14.18.2
-
NPM Version: 6.14.15
-
Yarn Version: 1.22.17
I want configure strapi::cors
middleware, based on the documentation I need to add the following to config/middlewares.js file
{
resolve: ‘strapi::cors’,
config: {
origin: [‘host1’, ‘host2’],
},
}
but when start strapi gives me the following error
Error: Could not load middleware “/home/dev/app/strapi::cors”.
1 Like
reorx
2
Also encountered this problem, but I found the example in this issue, hope it helps.
module.exports = [
// ...
{
name: "strapi::security",
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
"connect-src": ["'self'", "https:"],
"img-src": ["'self'", "data:", "blob:", "yourBucketName.s3.yourRegion.amazonaws.com"],
"media-src": ["'self'", "data:", "blob:", "yourBucketName.s3.yourRegion.amazonaws.com"],
upgradeInsecureRequests: null,
},
},
},
},
// ...
];