CORS issue http client

CORS Errors - Ionic Documentation (ionicframework.com)

As per documentation, localhost based on platform must be add in the server to fixed CORS issue. But based on this forum, In some way it might affect the security. Is it really true?

I was able to fixed my issue without adding localhost and use HttpNative, HttpNative has some limitation like form data, header body controls and etc. It drives me crazy and I know HttpClient will work expected without making a lot of changes than HttpNative.

Yes, this is true. Most of the content in the CORS doc is specific to the native platforms. When deploying to ios and android, because there is not custom port in the request URL, they will assume it’s from a web server and expect https. Since it’s not CORS will come into affect.

Avoid HttpNative.

1 Like