It’s not that complicated but when something breaks CORS adjacent, you’re stuck reviewing the gotchas.
I inherited both front and back-end. Their solution was "allow: *" (which is like saying, "I don't like carrying my house keys, so I removed the lock")
The system did require a "api.*" for other things, so my quick solution was a proxy_pass for /api.
...tap ...tap ...tap
No. Second top answer. https://stackoverflow.com/a/27280939/1507124
With the obvious WTF top comment and the natural follow-up. It solved my problem, therefore it's great.
See for instance this comment: https://news.ycombinator.com/item?id=29778528 Which suggests implementing the CORS response in a reverse proxy or some other covering layer.
And of course the OP also involves a reverse-proxy, although one mapping to avoid the need for CORS headers.
Instead, we now have a reverse proxy (haproxy) that "fixes" the missing CORS headers, by intercepting the OPTIONS call and return a dummy response with the correct headers included. The developer basically understand NOTHING in regards to CORS, so whenever the silly SPA breaks, the logic is always the same: "CORS is broken, fix it". At not point has it been an option to fix the API service to include the correct headers.
We could just have moved the API to /api and saved days of debugging and writing work-arounds, but no, api.customersite.com looks more professional.