Issue
I keep getting the below error when developing my ionic app. It's an authorization header not allowed by the backend.
Solutions tried:
- I use the chrome cors plugin here: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en
- 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.
Solution
Check the version of your Chrome browser. Probably it is one with a bug. Here are bug reports posted on May about this feature not working: https://bugs.chromium.org/p/chromium/issues/detail?id=857032
I have faced the same issue few weeks ago and here is how I managed to get disabled CORS: Firstly download the Chromium browser or Chrome canary browser, which are actually very good for developers (I user chromium, but it is up to you): https://www.google.com/intl/en/chrome/canary/ or https://download-chromium.appspot.com/
Then:
- Install browser
- If you run browser - close it and make sure that there is no more running instances
- Then run it with such command:
open -a ChromiumOrCanaryPathHere --args --disable-web-security --user-data-dir"
Now it should work. You probably will see warning message about security on the top of the window - that is OK.
P.S. Probably just updating chrome to latest version can help, but I prefer approach with separate browser as it is more secure because I can isolate not secure browser from my default browser.
Answered By - Artem Arkhipov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.