CORS configuration with HTTPS redirection problem

Progfahmy

Registered
Sep 23, 2020
1
0
1
Egypt
cPanel Access Level
Root Administrator
Hello There,

My Webserver has blocked an API in my website due to CORS policy that causes serious problems in loading website content.

I got this error:

" Access to XMLHttpRequest from origin has been blocked by cors policy
response to preflight request doesn't pass access control check" redirect is not allowed for a preflight request."

con someone help me please configure my .Htacess file?


Code:
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteCond %{HTTP_HOST} ^(www\.)?eagle-elearn\.com
    RewriteRule ^(.*)$ https://www.eagle-elearn/$1 [R,L]

   Header set Access-Control-Allow-Origin "*"

    # 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]
    Header always append X-Frame-Options SAMEORIGIN

</IfModule>