Rara’s page on desa.id asks gudang.kota.id: when the browser sends a letter asking leave (the OPTIONS preflight), which Allow-* headers the server must…
Why it matters
A CORS error looks like a client bug, yet the fix is on the server. Knowing what triggers a preflight and which Allow-* headers are needed means no more guessing: you fix the right thing at once.
The key idea
CORS is a browser rule, not a server one
Common mistakes
Content-Type: application/json triggers a preflight Very common and surprising. The server must answer the OPTIONS with Access-Control-Allow-Headers: Content-Type.
Thinking CORS is server security CORS is a browser rule that protects users. curl/Postman are not affected, and a simple request is still carried out by the server, so the server must still check tickets and permissions itself.
credentials with Allow-Origin: * Not allowed. Name the origin exactly and add Access-Control-Allow-Credentials: true, or the request fails.
Try it in this playground
Send JSON across originsapplication/json is not a simple Content-Type: an OPTIONS letter leaves first.
Send plain text with no CORS rules The gudang still records it; the browser only holds back the reply.
Use cookies with Allow-Origin: * The wildcard does not count for a request with cookies.
Send it with curl No browser, no CORS: the reply is read even without any rule.