I am using 3rd party API from which I am getting the below error:
Access to XMLHttpRequest at 'https://myapi/..' from origin 'https://mydomain.xyz' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I am wondering how to enable CORS policy in my application. my .htaccess file is :
<IfModule mod_rewrite.c>
Header set Access-Control-Allow-Origin "*" // this line I added but no work
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I am using Laravel application. thanks in advance.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3fjeje3
via IFTTT
Aucun commentaire:
Enregistrer un commentaire