title: Amazon CloudFront cross-origin headers on fonts
body: <p>I have a CloudFront distribution that blocks the font download in Chrome (desktop version) with the fallowing error:</p>
  
  <blockquote>
    <p>Font from origin '<a href="https://....cloudfront.net" rel="nofollow noreferrer">https://....cloudfront.net</a>' has been blocked from
    loading by Cross-Origin Resource Sharing policy: No
    'Access-Control-Allow-Origin' header is present on the requested
    resource. Origin '<a href="https://example.com" rel="nofollow noreferrer">https://example.com</a>' is therefore not allowed
    access.</p>
  </blockquote>
  
  <p>Where should I set this Access-Control-Allow-Origin header?</p>
  
  <p>I tried adding the header in the "Origin" section of the could distribution but it does not produce any effect.</p>
  
  <p><a href="https://i.stack.imgur.com/GVli9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GVli9.jpg" alt="enter image description here"></a></p>
  
  <p><strong>EDIT #1:</strong> </p>
  
  <p>Nginx configuration on origin has the fallowing directive:</p>
  
  <pre><code>location ~ \.(eot|ttf|woff|woff2)$ {
      add_header Access-Control-Allow-Origin *;
  }
  </code></pre>
  
  <p>which on this test <code>curl -I https://example.com/skin/frontend/smartwave/default/megamenu/css/fonts/fontawesome-webfont.woff</code></p>
  
  <p>Retuns the fallowing response:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>From what I see here this header <code>Access-Control-Allow-Origin</code> is missing.</p>
  
  <p>Also I whitelisted the header on CloudFront so that it will not block it:</p>
  
  <p><a href="https://i.stack.imgur.com/jvMh7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jvMh7.jpg" alt="enter image description here"></a></p>