'How to configure internal middlewares for strapi v4?

I was face with this issue,

take for instance you want to configure strapi::cors middleware. according to the documentation we do

{
resolve: ‘strapi::cors’,
config: {
origin: [‘host1’, ‘host2’],
},
}

this won't work.



Solution 1:[1]

Use "name" property like this.

{
name: ‘strapi::cors’,
config: {
origin: [‘host1’, ‘host2’],
},
}

If it help you, vote up.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Declan Nnadozie