Hi, I want to build an ionic 4 with request a website,
I disable CORS on chrome on ionic serve, but once deployed on the device (android 7) CORS error is thrown…
for example, once I try to http get google.com => CORS triggered
These didn’t happen on my Ionic 3 apps, but happen on ionic 4.
I used on my ionic 3 app, but with a newly created ionic 4 app CORS seems to be forbidden. is there a clue to make it work?
SystemWebChromeClient: http://localhost:8080/: Line 0 : Failed to load https://www.google.com/?gws_rd=ssl: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
chromium: [INFO:CONSOLE(0)] "Failed to load https://www.google.com/?gws_rd=ssl: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.", source: http://localhost:8080/ (0)
If it is not an possibility to implement or configure CORS in the server, there is a native plugin that can “proxy” the HTTP requests using native code, so CORS can be completely bypassed:
But the angular http interceptors wont work with the native solution… Right ? Is there a better way to handle authorization headers, because i was using angular http interceptor for headers and some ore stuff. Also if we are using only native http plugin then we cant use debugger as well. And Ionic Serve will also not work, becuase we dont have cordova there… its too bad with Ionic 4, introducing many big big breaking changes, i band my head almost everyday now for trying out Ionic 4.
This sucks sideways that it (http native) doesn’t work in Chrome. I also tried angular HttpClient, but then I get CORS error and the Chrome CORS -plugin doesn’t help either (works in Ionic 3) and I do not have access to the API to disable the cors issue at backend. This issue is really annoying. Debugging is way more difficult when you have to run on device.