Getting CORS error due to `Access-Control-Allow-Origin` header getting set twice - Strapi V4

System Information
  • Strapi Version: 4.15.5
  • Operating System: Mac OS 13.0
  • Database: Postgres
  • Node Version: 18.18.0
  • NPM Version: 9.8.1

I am getting this following error due to Access-Control-Allow-Origin header getting set twice

Access to XMLHttpRequest at https://cms.yyy.com/api/data/all from origin https://xxx.yyy.com has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header contains multiple values https://xxx.yyy.com,https://xxx.yyy.com but only one is allowed.

I am using strapi cms for my backend data. strapi::cors is already added in middleware. I have already tried these following configs

{
name: 'strapi::cors',
config: {
  origin: ['https://xxx.yyy.com'],
},
{
name: 'strapi::cors',
config: {
  origin: 'https://xxx.yyy.com',
},
{
name: 'strapi::cors',
config: {
  origin: "*",
},

but none of this solved the issue.

enter image description here