Example of nginx server configuration with CORS.
server {
listen 80;
server_name cdn.ondrejsika.com
if ($request_method = 'OPTIONS') {
return 200;
}
add_header 'Access-Control-Allow-Origin' 'http://ondrejsika.com';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Content-Type, Accept, X-Requested-With';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
location / {
alias /var/cdn.ondrejsika.com/;
}
}