Amazon CloudFront Font Cross Headers

I have a CloudFront distribution that blocks font downloads in Chrome (desktop version) with an error:

Font from source ' https: //....cloudfront.net ' blocked downloading by resource sharing policy Cross-Origin: No The header for the Access-Control-Allow-Origin header is present in the requested resource. Origin ' https://example.com ' so access is not allowed.

Where should I set this Access-Control-Allow-Origin header?

I tried to add a title in the "Origin" section of the can distribution, but this has no effect.

enter image description here

EDIT. # 1:

The Nginx configuration in the source has a directive:

location ~ \.(eot|ttf|woff|woff2)$ {
    add_header Access-Control-Allow-Origin *;
}

which on this test curl -I https://example.com/skin/frontend/smartwave/default/megamenu/css/fonts/fontawesome-webfont.woff

Returns the answer:

HTTP/1.1 200 OK
Server: nginx
Date: Tue, 02 Feb 2016 17:53:39 GMT
Content-Type: application/font-woff
Content-Length: 44432
Last-Modified: Wed, 13 May 2015 15:58:11 GMT
Connection: keep-alive
ETag: "55537493-ad90"
Pragma: public
Cache-Control: max-age=31536000, public, must-revalidate, proxy-revalidate
Accept-Ranges: bytes

, , Access-Control-Allow-Origin .

CloudFront, :

enter image description here

+4
1
+2

Source: https://habr.com/ru/post/1626877/


All Articles