DEV Community

Cover image for Overcome CORS errors during development in Chrome
Hardique Dasore
Hardique Dasore

Posted on • Edited on

3 1

Overcome CORS errors during development in Chrome

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!

Image description

Follow us on Instagram

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay