0
Access to font at '/fonts/fontawesome-webfont.woff?v=4.7.0' from origin 'https://www.origin.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Magento 2 https://www.origin.com, we created CloudFront for static and for media files. I get this error for all fonts woff,woff2 and ttf and also js-translation.json.

My ngnix settings:

location / {
try_files $uri $uri/ /index.php$is_args$args;
    location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
    add_header Access-Control-Allow-Origin * always;
    }
    location ~* \.(eot|ttf|woff|woff2)$ {
    add_header Access-Control-Allow-Origin * always;
}
}
location /pub/ {
location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
    deny all;
}
location ~* \.(eot|ttf|woff|woff2)$ {
    add_header Access-Control-Allow-Origin * always;
}
alias $MAGE_ROOT/pub/;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Frame-Options-2 "SAMEORIGIN-2";
}

I also updated setting on CloudFront from here https://aws.amazon.com/premiumsupport/knowledge-center/no-access-control-allow-origin-error/

Also tried NGINX cross control origin header added but font files still blocked by CORS policy

Nothing helps. Please advise

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.