I faced with the same issue. We use laravel 8 for the backend and React/Next.js for the frontend in our project. It seemed like everything worked ok, but when I tried to upload a file more than 1Mb, I got the error like yours:
Access to XMLHttpRequest at 'https://api.my-domain.com/api/messages' from origin 'https://my-domain.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Actually, the problem was not in cors, it was about client_max_body_size You can check it in nginx docs
So, I've just add this line:
client_max_body_size 5m;
to the server block of my /etc/nginx/sites-available/my-domain.com and it solved the issue. If you need it for all your projects, you should add it to your /etc/nginx/nginx.conf
Hope, it helps.