So I have been working on a SPA project which uses API calls and I have had a headache with Cross Origin Resource Sharing (CORS) setup on Chrome because APIs aren’t on my localhost naturally, making a call to other domain. hence the problem of CORS cause Chrome doesn’t let you access resources which aren’t on the same server as your app.
long story short, I found this hack which comes in handy with this problem. just follow below steps:
- go to “C:\Program Files (x86)\Google\Chrome\Application” address.
- right click on Chrome’s icon, right click and then send to desktop.
- go back to the desktop and right click on the shortcut you just created.
- select Target from Shortcut tab and enter “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” –disable-web-security –user-data-dir=”c:/Chrome”
- press ok and start Chrome from the shortcut.
- you’ll get a notification saying “You are using an unsupported command-line flag…” just ignore that and run your app.
Comments 0