What is CORS?

Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any other origins (domain, scheme, or port) than its own from which a browser should permit loading of resources.

For example, web app on domain http://domaina.com makes the HttpRequest to a web app on domain http://domainb.com.

How CORS work?

In modern browsers due to security reasons cross-origin HTTP request is not allowed.

Whenever there is a CORS request browser will send a preflight request prior to sending the actual request to find out whether CORS request is valid or not.

The preflight…

Aakash Sorathiya

A Developer with strong passion for self-improvement.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store