PHP: No "Access Control Allow Origin" header is present on the requested resource
P粉032649413
P粉032649413 2024-01-28 22:37:10
0
1
354

In .htaccess I have it as shown below. But I keep getting errors.

Access to XMLHttpRequest at "https:..." from origin "https://..." has been blocked by CORS Policy: 'Access-Control-Allow-Origin' header does not exist on Requested resource.

Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Origin "PUT, POST, DELETE, GET, OPTIONS"
Header set Access-Control-Allow-Origin "Accept, Authorization, Content-Type"

RewriteEngine On
Options All -Indexes

# ROUTER WWW Redirect.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ROUTER HTTPS Redirect
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ROUTER URL Rewrite
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?route=/ [L,QSA]

P粉032649413
P粉032649413

reply all(1)
P粉593118425

You can only have one "Allow origin" header, so the last header will be interpreted.

Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "PUT, POST, DELETE, GET, OPTIONS"
Header set Access-Control-Allow-Headers "Accept, Authorization, Content-Type"
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template