Resposta curta e em inglês, para ler, fechar e treinar em voz alta.
Cross-Origin Resource Sharing lets a server opt into browser JavaScript reading selected cross-origin responses. An origin is a scheme, host, and port. Credentialed sharing requires an allowed specific origin rather than a wildcard.
Some requests are sent without a preflight even if the browser later blocks JavaScript from reading the response. Other requests require a successful OPTIONS preflight before the actual request is sent.
Trap: CORS is not authentication, authorization, or a CSRF defense by itself. Non-browser clients do not enforce it, and inability to read a response does not prove a request had no effect.
Source: MDN CORS.
Essa pergunta tem uma armadilha que derruba muita gente em entrevista. Ela está marcada na resposta acima: vale reler antes de treinar.
Ler é o primeiro passo. No app, essa pergunta vira flashcard com repetição espaçada, e o módulo tem quiz e simulado para testar o que ficou.
Treinar essa pergunta no app