Posts

Showing posts with the label How to enable Cross-Origin Requests (CORS) in ASP.NET Core?

How to enable Cross-Origin Requests (CORS) in ASP.NET Core?

Browser security prevents a web page from making requests to a different domain than the one that served the web page. This restriction is called the  same-origin policy . The same-origin policy prevents a malicious site from reading sensitive data from another site. Sometimes, you might want to allow other sites to make cross-origin requests to your app. For more information, see the  Mozilla CORS article . Cross Origin Resource Sharing  (CORS): Is a W3C standard that allows a server to relax the same-origin policy. Is  not  a security feature, CORS relaxes security. An API is not safer by allowing CORS. For more information, see  How CORS works . Allows a server to explicitly allow some cross-origin requests while rejecting others. Is safer and more flexible than earlier techniques, such as  JSONP . Same origin Two URLs have the same origin if they have identical schemes, hosts, and ports ( RFC 6454 ). These two URLs have the same origin: https://exa...