CORS
Understand preflight, allowed origins and credentialed requests.
What you will be able to do
- CORS is enforced by the browser.
- Preflight is an OPTIONS request.
- Wildcard origins cannot be used with credentials.
- Fix CORS on the server.
In plain English
CORS is a browser policy that lets a server opt into cross-origin reads. Simple requests are sent directly; others trigger an OPTIONS preflight. The server, not the client, decides with Access-Control-Allow-Origin.
Access-Control-Allow-Origin: https://www.edubyte.tech
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Credentials: trueYour turn
EasyAllow one origin
Write an Access-Control-Allow-Origin header for https://www.edubyte.tech.
HTTP · starter
Access-Control-Allow-Origin:Check your understanding before moving on.
Knowledge checkQuestion 1
Which request method does a preflight use?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.