Disable Access-Control-Allow-Origin from Apache or htaccess?

Muhammad_Adel

Registered
Feb 6, 2018
1
0
1
Egypt
cPanel Access Level
Root Administrator
in my local machine when I try to send request via ajax using cross domains the request doesn't complete I added this options to .htaccess file

Header always set Access-Control-Allow-Origin "https://accepted-domain"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"

RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]

after that every things worked just fine but when I uploaded this to my cPanel server the request didn't completed but when I removed this lines from the .htaccess file every thing worked just fine

the question is how to disable this Access-Control-Allow-Origin in my cPanel host to define it with the domain I want to accept only
Note
when I sent the request on my cPanel hosting the response was this message

Failed to load http://receiver-domain.com/create.php: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed. Origin 'http://sender-domain.com' is therefore not allowed access.

which mean the Access-Control-Allow-Origin has been set somewhere else