Strapi v4 cors gets a bug when use filters operators

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Hi.

When I use an filter operator in the query it fails and throws a cors error:

Access to XMLHttpRequest at 'http://myapi.com/api/...' from origin 'http://myapp.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I’m not sure it’s really a cors problem, but a bug that causes it.

This query:

https://myapi.com/api/table?filters[name]=thename

works perfectly but

https://myapi.com/api/table?filters[name][$eq]=thename

produces the error

Any operator triggers the error ($eq, $or, $and, $lt, …) like

https://myapi.com/api/table?filters[date][$lte]=2022-03-01&filters[date][$gte]=2022-04-01
https://myapi.com/api/table?filters[$or][0][date][$eq]=2022-03-01&[$or][1]filters[date][$eq]=2022-04-01
...

This only happens on the server, in localhost all queries work fine.

Anyone else has happened? Does anyone know what the problem is? Any idea how to fix it?

Thanks