Sorry to hijack this, but it's practically the same thing.
My frontend testsite.test is hitting api.testsite.test. I am getting a CORS error just like the OP. However, after testing, it seems to only be happy if I put the entire URL:
'allowed_origins' => ['https://testsite.test'],
Simply doing *.testsite.test wasn't working nor testsite.test.
Odd that I am having to also pass https:// as well.
Any idea why this is happening to me?
-- EDIT--
FWIW this laracasts page was one of the first results in Google (for however I worded it). So this would be a good place to add more info to help others out in the future stumbling upon this page :)
It seems when sending requests with credentials, the wildcard is not acceptable.
In my case, I am using Inertia (Vue3) with sanctum and laravel sessions. So my JS knows about my logged in user and handles it.
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
When responding to a credentialed requests request, the server must specify an origin in the value of the Access-Control-Allow-Origin header, instead of specifying the "*" wildcard.