What is CORS?
Cross-Origin Resource Sharing (CORS) is a browser security mechanism that controls when JavaScript on one origin can make requests to a different origin. Without CORS, the same-origin policy would block all cross-origin requests.
CORS is not a security feature — it's a relaxation of security. The same-origin policy protects users by default. CORS headers tell the browser to allow specific cross-origin requests that would otherwise be blocked.