Konubinix' opinionated web of thoughts

Cross-Origin Resource Sharing

Fleeting

CORS (Cross-Origin Resource Sharing) is a system, consisting of transmitting HTTP headers, that determines whether browsers block frontend JavaScript code from accessing responses for cross-origin requests

https://developer.mozilla.org/en-US/docs/Glossary/CORS

preflight request

CORS preflight request is a CORS request that checks to see if the CORS protocol is understood and a server is aware using specific methods and headers

https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request

It is an OPTIONS request, using three HTTP request headers:

  1. Access-Control-Request-Method,
  2. Access-Control-Request-Headers,
  3. and the Origin header.

https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request

simple request

When providing the origin header, the server automatically returns the access-control-allow-XXXX headers and the browser won’t deal with the data in that case in the cors data is wrong.