CORS headers

The Access-Control response headers a server uses to tell browsers which origins, methods and headers may be used across origins, and for how long.

In more detail

Allow-Origin names the permitted origin, Allow-Methods and Allow-Headers list what the real request may use, and Max-Age says how many seconds the browser may cache the preflight answer. Credentialed requests also need Access-Control-Allow-Credentials, and then the allowed origin must be named exactly rather than given as a wildcard.

Examples

In the APIs course: The course service copies the one origin it recognises into Allow-Origin instead of answering with a wildcard.
Access-Control-Allow-Origin: https://course.example
Access-Control-Max-Age: 600

Related terms

Taught in

References