Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable cors in chrome Mac

I keep getting the below error when developing my ionic app. It's an authorization header not allowed by the backend.

enter image description here

Solutions tried:

  • I use the chrome cors plugin here: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en

enter image description here

  • as well as started chrome disabling web security as below

open -a Google\ Chrome --args --disable-web-security --user-data-dir

  • Set up a ionic proxy as in this post: https://stackoverflow.com/a/41863260/838355

but I still can't bypass cors check, the error persists. Need some help.

like image 518
ir2pid Avatar asked Sep 14 '25 04:09

ir2pid


2 Answers

If you want to disable the CORS on chrome on mac you can run this command on your terminal/Item. it will open a new instance of chrome and all the tabs of this instance will have disabled the CORS. So you can run your application here for testing. I hope this you are doing just for testing your APIs and you know this is not a permanent fix. Also, remember this is disabling your web security. so I think this is a good option for testing your API when you are not worried about the security and you will have all the web security place when you are going to run your application on another environment like dev, and qa, and prod.

open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security
like image 95
Seeta Ram Yadav Avatar answered Sep 15 '25 17:09

Seeta Ram Yadav


In terminal enter :

open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security
like image 42
Suraj Kumar Avatar answered Sep 15 '25 17:09

Suraj Kumar