Cross-Origin Resource Sharing exists because browsers, by default, block a page from making requests to a different origin than the one it was served from - a security boundary, not a bug. CORS is the mechanism a server uses to explicitly opt certain origins back in.
// Server response header
Access-Control-Allow-Origin: https://prantatech.eu.org
Simple requests vs preflighted requests
A plain GET request goes straight through with just that header checked. A request with custom headers, or a method like PUT or DELETE, triggers a preflight - the browser sends an OPTIONS request first, asking permission before sending the real one:
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Headers: Content-Type, Authorization
The fix is always on the server, never the client
No amount of client-side JavaScript can work around a missing CORS header - and it shouldn't be able to, since the whole point is that the server, not the browser, decides who's allowed to ask.
It's a browser restriction, not a server restriction
The same-origin policy that CORS relaxes is enforced entirely by the browser - a server has no inherent objection to receiving a cross-origin request, and tools like curl or Postman never trigger a CORS error at all. That distinction confuses a lot of developers seeing "No 'Access-Control-Allow-Origin' header" for the first time, since the request often did reach the server successfully; the browser just refused to hand the response back to the calling script.
// Server must explicitly opt in
res.setHeader('Access-Control-Allow-Origin', 'https://example.com');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST');
Preflight requests explain the mysterious extra OPTIONS call
For anything beyond a simple GET - a POST with JSON, a custom header, a PUT or DELETE - the browser sends an automatic OPTIONS preflight request first, asking the server for permission before sending the real one. Seeing an unexpected OPTIONS request in the network tab isn't a bug; it's the browser checking CORS permissions ahead of the actual request, and the server needs to answer it correctly for the real request to proceed at all.