Hi,
I am getting No 'Access-Control-Allow-Origin' Error my site, it NGINX.
My page is trying to get data from my storage server, its trying to get fonts and some images in CSS Ex.
----------------------------------------------
@font-face {
font-family: JCQBAA-BTraffic_1bn;
src: url("http://www.***.com/10356/fonts/[login to view URL]") format("woff");
}
-----------------------------------------------
data="http://www.***.com/10356/1/[login to view URL]"
What I already tried is.
* Add header on top of PHP page
-----------------------------------------------
$origin=isset($_SERVER['HTTP_ORIGIN'])?$_SERVER['HTTP_ORIGIN']:$_SERVER['HTTP_HOST'];
header('Access-Control-Allow-Origin: '.$origin);
header('Access-Control-Allow-Methods: POST, OPTIONS, GET, PUT');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Headers: Authorization, X-Requested-With');
header('P3P: CP="NON DSP LAW CUR ADM DEV TAI PSA PSD HIS OUR DEL IND UNI PUR COM NAV INT DEM CNT STA POL HEA PRE LOC IVD SAM IVA OTC"');
header('Access-Control-Max-Age: 1');
* Add on Nginx.
-----------------------------------------------
location ~* \.(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin "***.com";
}
location / {
if ($http_origin ~ "^(http://www.***.com)$") {
add_header "Access-Control-Allow-Origin" $http_origin;
}
}
We are trying to get this on both http and https sites.
Hello, I am a UK based developer with plenty of experience in PHP. I have written both new projects and maintain a lot of websites for my clients.
Please contact me to get the nginx headers error resolved today.