Why the hell does CORS only support exactly one origin domain or wildcard? Such a silly decision to not allow comma separated values or wildcard subdomains.
I don't know what the actual reason was, but I would guess the design decision was made so the multiple domains use case would be infinitely scalable. Otherwise you would run into header length limitations. Imagine trying to fit 10,000 domains into the header! Eventually you'd need something like this implementation anyways.
My guess is that it's related to subdomains not guaranteeing to be from the same origin.
The result is that people run into errors, Google them, copy paste the top SO result which advices to allow *
Doesn't seem ideal