An HTTP header carries metadata or control information between a client and server. CORS uses response headers to control which cross-origin requests a browser may accept. section 10.1
CORS commonly uses these headers:
- Access-Control-Allow-Origin specifies which foreign origins may access resources. section 10.1
- Access-Control-Allow-Methods limits permitted HTTP methods, such as GET. section 10.1
- Access-Control-Allow-Headers limits which headers a request may contain. section 10.1
Diagnosing a blocked cross-origin request
A page served from http://localhost:8080 sends a POST request to http://127.0.0.1:8080/test. The server can process the request, but the browser rejects the response when it lacks Access-Control-Allow-Origin. Spring Security adds none of these CORS headers by default. section 10.1
Figure 10.4 For simple requests, the browser sends the original request directly to the server. The browser rejects the response if the server doesn’t allow the origin. In some cases, the browser sends a preflight request to test whether the server accepts the origin. If the preflight request succeeds, the browser sends the original request.
Trace the browser’s handling of simple and preflighted requests, including when it sends the original request and when it checks permission first. section 10.1



