access to XMLHttpRequest 'api link' from origin 'http://localhost:8100' has
been blocked by cors policy: response to perflight doesn't pass access to
contrsol check: it doesn't have http ok status
I've built magento apis and my partner call those apis through ionic and get that error I have added following lines to .htaccess file in magento root directory:
<IfModule mod_headers.c>
Header set X-UA-Compatible "IE=edge"
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
Header unset X-UA-Compatible
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "GET, POST, PUT, DELETE"
Header always set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
</FilesMatch>
and added those lines to httpd.conf in apache:
<Directory />
AllowOverride none
Require all denied
Header set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "GET, POST, PUT, DELETE"
Header set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
</Directory>