Every time I try to set the Access Control Allow Origin method it always returns;
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com' is therefore not allowed access. The response had HTTP status code 405.
It reads every other header set as I removed them one by one to check this and the related error occurs whenI do. The Only one that isn't read is the one in question.
Here is my config;
location / {
add_header 'Access-Control-Allow-Credentials', 'true';
add_header 'Access-Control-Allow-Origin' 'http://example.com';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Expose-Headers' 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, X-CSRF-TOKEN, X-MODE';
add_header 'Access-Control-Allow-Headers' 'X-CSRF-TOKEN';
try_files $uri $uri/ /index.php?$query_string;
}
specs: Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-98-generic x86_64)
If anyone can see what I'm doing wrong please share!
Regards