Overcome CORS errors during development in Chrome

Hardique Dasore
1 min readAug 13, 2022

--

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:

  1. Open Start window
  2. Search Run and open it or press Window+ R
  3. 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!

--

--

Hardique Dasore
Hardique Dasore

Written by Hardique Dasore

Hardique is a dynamic Frontend/UI Developer with 4 years of experience creating streamlined and and intuitive controls through programming.

No responses yet