Cross-Origin Resource Sharing (CORS) allows the website of one URL request data from a different URL.
CORS error is a mechanism to restrict users from accessing shared resources.
The browser blocks this to fight one of the most common cyber attacks i.e. cross-site request forgery.
The browser, therefore, throws an error every time, the website tries to fetch data from a different base URL.
To overcome CORS errors in Google Chrome, we need to disable the web security of the browser.
Please follow the below-mentioned steps:
Runand open it or press
chrome.exe --user-data-dir="C://Chrome dev session" --disable-web-securityand execute it
This will open a new browser with web security disabled.
You can now access your project in this browser without worrying about the CORS errors.
Note: This is a temporary fix and should only be used during the development phase.
Follow us on Instagram