What is CORS ? Why does it happen ? How to solve for it ?

Understanding how Cross-Origin Resource sharing and the Single Origin Policy work.

Photo by Sammyayot254 @ https://superadmins.co on Unsplash

Same Origin Policy (SOP)

Back to CORS

origin: https://www.abc.com
access-control-allow-origin: https://www.abc.com
origin: https://www.abc.com
access-control-request-method: DELETE
access-control-request-headers: origin, authorization
access-control-allow-methods: POST, GET, OPTIONS, DELETE
access-control-allow-origin: https://www.abc.com
access-control-allow-headers: origin, authorization, cache-control

Solutions to the CORS Error

--

--

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