CORS is a stupid idea that serves no purpose. If someone is really determined they will either 1) turn off CORS with a browser extension 2) simply call your precious API from something other than an a browser It is essentially security by obscurity and protects nothing. Don't get me started how some technologies like AWS Lambda with a Gateway, when a function has an error, responds by default in such a way it makes t…
> It is essentially security by obscurity and protects nothing.
What.
I think there's been a fundamental misunderstanding of who is being protected here on your part, and what CORS is actually for.
It's your run-of-the-mill user that CORS protects, and CORS being enforced protects them when they visit e.g. an attacker-controlled site with, for example, a valid cookie-based session on your service. It prevents the attacker's site from making dangerous authenticated requests to your API service and reading the result.
> If someone is really determined they will either 1) turn off CORS with a browser extension 2) simply call your precious API from something other than an a browser
That's not what CORS is designed to protect against at all, of course you can hit an API separately and your HTTP client will ignore the CORS headers. Your HTTP client isn't a browser! It doesn't need to worry about CORS.
Similarly, users shooting themselves in the foot by disabling CORS are only hurting themselves. They are not the attacker here.