What is a CORS error?
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:
- Open
Start
window - Search
Run
and open it or pressWindow
+R
- Paste
chrome.exe --user-data-dir="C://Chrome dev session" --disable-web-security
and 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.
Happy Coding!
Follow us on Instagram
Top comments (0)