Hey guys,
Can somebody help me out with a standard middleware.ts configuration for aws s3 provider.
I would like to introduce a dynamic img-src and media-src url that depends on the current env.
like ${process.env.AWS_BUCKET}.s3.${process.env.AWS_S3_REGION}.amazonaws.com,
unfortunately that does not work for me with v4.25.2. Does anybody have an idea?
middleware.ts
export default [
'strapi::logger',
'strapi::errors',
{
name: 'strapi::security',
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
'connect-src': ["'self'", 'https:'],
'img-src': [
"'self'",
'data:',
'blob:',
'localhost:9000',
`${process.env.AWS_BUCKET}.s3.${process.env.AWS_S3_REGION}.amazonaws.com`,
],
'media-src': [
"'self'",
'data:',
'blob:',
'localhost:9000',
`${process.env.AWS_S3_BUCKET}.s3.${process.env.AWS_S3_REGION}.amazonaws.com`,
],
upgradeInsecureRequests: null,
},
},
},
},
'strapi::cors',
'strapi::poweredBy',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
];
This topic has been created from a Discord post (1264568040381481105) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord