[Solved] CORS problems and No Access-Control-Allow-Origin header errors with Ionic

preview_player
Показать описание
Fixed CORS problems and No Access-Control-Allow-Origin header errors with Ionic.

Add these 4 line codes in your header of the PHP file.

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST ,OPTIONS, PUT');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
header('Content-Type: application/json');

If Still issue comes then you need to use Advanced Http Cordova Plugin

🔥 TMD Hosting Affiliate

🔥 DIGITAL OCEAN HOSTING Offer

🔥 Hostinger Hosting Offers

Stay Connected With Us:

#cors
Рекомендации по теме
Комментарии
Автор

Thanks BROO, You're Amazing!! I've been looking for solution for more than 5 days. And finally your video makes it happen

jitanx
Автор

Unbellievable. You just saved Me in 2O20. Thanks.

nadjinmalade
Автор

thank you bro.. best regard from indonesia

codinggoIndonesia
Автор

Thank you bhai you are you saved my thank youuuu very mucccch <3 <3 <3

rsvhmqt
Автор

this video is helpful if you can change cors from the back-end server side.

malkasoft
Автор

what if the vendors say they are not using any cors policy from their side but on client-side when you deploy your project in eclipse you have a pre-defined web.xml file appeared how to resolve this how to then disable on client side as well

fahamarafi
Автор

Iam add property file what you tell 3 but not work for me client side angular cross origin error 401 status error server side security code

krishnashauzshenikala
Автор

I am using woocomrc api v3. Facing the issue when i am posting data . Where should i paste the code to solve the cros issue

manojmohapatra
Автор

Hi Hostguru, where do you add the headers if you are using typescript?

peterdev
Автор

I have same error but in node.js what should i do

mohtishammuzzammil
Автор

I am using Ionic 4 as frontend and Laravel 5 as as backend.. So let me know where to put the mentioned code?

mysalman
Автор

hello, how are you??
I have the same problem, I'm working with proyect in 000webhost, i tried to put the three lines of headers, but still the same problem...

luisvacahoyos
Автор

i know that, but it will not good, because it ill reduce app performance.

MrPrasadpankaj
Автор

How can it be ionic. You r fixing it on php server side. 😭😭😭

suchi