How to Fix Ionic CORS Issues with Proxy or Native HTTP

preview_player
Показать описание
If you encounter Ionic CORS issues you can either fix this inside the API or use one of these solutions to tackle the problem yourself!

#############################

👨‍💻 Want to read instead of watch?

😱 NEW: Capacitor Crash Course!

⚡️Take my famous 7 Day Ionic Crash Course

🤷‍♂️Want more Ionic tutorials?

#############################

❤️You can also find me...

Or join our Facebook group:

#############################

00:00 Intro
01:30 Ionic App Setup
02:39 CORS Anywhere Package
03:16 CORS Proxy Setup
06:36 Ionic CORS Proxy
07:31 Capacitor native HTTP Plugin
14:35 Outro
Рекомендации по теме
Комментарии
Автор

Simon, you are my hero. I've been struggling with something for days now, until I found this tutorial. I'm a Simonic forever! Bravo Sir!

tonyross
Автор

Thanks man. I really needed to set that proxy server to use an 3rd party API for my react app. Thanks for showing how to set it up.

ShivamSharma-nlmg
Автор

Thank you Simon, you always help me with IONIC!

matheuseli
Автор

Great news, hopefully cap v3 is on shortly, all proxy and backend side modifications sometimes is tiring, thanks Simon.

Автор

Excelent!! This had helped me a lot! Thank you!!

guibson
Автор

Hello Simon, thanks for the video. I implemented this plugin in my project but when I run my app on Android emulator and try to login (behind we have a HTTP post request sending data such as email and password), I get this error: {"code":"UNIMPLEMENTED"} . Do you know what does this mean?

siberjanaxhabafti
Автор

hello Simon
can we use one proxy server to many project?

mobiliseapplabllp
Автор

Hi Simon! I coud not make it work with capacitor 3 (I meant capacitor-community/http). Any example to help?
Error: "Http.post()" is not implemented on android

mgtozzi
Автор

I have a cors preflight error when i do the Post requête, but it’s work for Get, Put ...

davidbreezy
Автор

Hi Simon. I have access to my backend application... could you have any doc to read in how to fix this CORS problem form the backend with wordpress... Not only the code ... where should be this code in a wordpress site. I appreciate and I thing many people as well.

alejandroflamerich
Автор

How to do it with Cloudflare because i am getting error when i implements api using cloudflare

asifsorathiya
Автор

quicktip: if you're just waiting to get cors fixed by backend, you can use the "CORS Unblock" chrome plugin.
No implementations needed. Just install and use.
Works like a charm.

Dimitri
Автор

now only i am facing the cors issue, you upload video like god, thank you so much

sathithyayogi
Автор

Good Solutions Simon, I love it :D
Maybe I will use capacitor in my future professional projects, I already tried it and it was interesting (some projects for test), the only problem for now is Msadal (azure auth) plugin that's why I can't use it.
maybe i will try test the capacitor 3 in my personal projects.

Ali-ysej
Автор

Hello, I am getting this error how I can solve this?

ShubhamSingh-mquw
Автор

thank you simon, you always heped me with ionic, one thing the data from the get request cannot be consoled in android studio?

marwenbenmahmoud
Автор

Thanks Simon,
Do you known how fix the problems using admob with ionic capacitor project, would you consider a tutorial for that.

javiermane
Автор

Hi Simons, I tried the same solution. It works fine but with post request Body is emty. I don't know the reason behind it.
const {Http} = Plugins;
const options = {
url: `${environment.nodejsGateway}/login`,
data: form,
};
console.log("options")
console.log(options)
return from(Http.request({ ...options, method: 'POST' })).pipe(
map((result:any) =>result.data)
);

ranakandeil
Автор

Can you please explain in which cases our app throw cors issue and can it be relate to the server (500) error.

mr.aj
Автор

Thanks Simon, a very useful update on CORS issues. I have used Http plugin from capacitor and still experienced some CORS issues. Not always, which is weird, but something like 1 out of 20 API calls results in CORS error. I ended up implementing an automatic retry in case of API call error, but still kind of strange isn't it? Anyone has faced this too?

TheSaceone