Tutorial by Examples

A cross-origin request must be sent including the Origin header. This indicates from where the request originated. For example, a cross-origin request from http://example.com to http://example.org would look like this: GET /cors HTTP/1.1 Host: example.org Origin: example.com The server will us...
The response to a CORS request must include an Access-Control-Allow-Origin header, which dictates what origins are allowed to use the CORS resource. This header can take one of three values: An origin. Doing this permits requests from that origin only. The character *. This permits requests from...
Allowing user credentials or the user's session to be sent with a CORS request allows the server to persist user data across CORS requests. This is useful if the server needs to check if the user is logged in before providing data (for example, only performing an action if a user is logged in - this...
A basic CORS request is allowed to use one of only two methods: GET POST and only a few select headers. POST CORS requests can additionally choose from only three content types. To avoid this issue, requests that wish to use other methods, headers, or content types must first issue a preflig...
When a server receives a preflight request, it must check if it supports the requested method and headers, and send back a response that indicates its ability to support the request, as well as any other permitted data (such as credentials). These are indicated in access-control Allow headers. The ...

Page 1 of 1