Cross-domain font-face issues

后端 未结 4 384
遇见更好的自我
遇见更好的自我 2021-02-04 04:47

please read all of this before commenting.

I\'m currently working on a large website which is hosted on Amazon Web Services (AWS). This allows us to use scalability feat

相关标签:
4条回答
  • 2021-02-04 05:19

    Currently, serving webfonts from AWS likely won't work in Firefox and IE 9+ because AWS doesn't support the Access-Control-Origin-Header. See this post on the AWS forums. Seems to be a problem for a lot of people.

    Update 7/17/12:

    As an alternative to AWS, Google's cloud services support cross-origin file serving. I just set up a bucket to serve webfonts, and it seems to be working. See this blog post and the documentation for more info.

    0 讨论(0)
  • 2021-02-04 05:21

    Try do this:

    On your server you will need to add:

    Access-Control-Allow-Origin
    

    To the header of the font files, so for example if you are using Apache you can add this to the .htaccess:

    <FilesMatch "\.(ttf|otf|eot|woff)$">
      <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
      </IfModule>
    </FilesMatch>
    

    My problem solved with this method.

    0 讨论(0)
  • 2021-02-04 05:23

    This is possible using S3 without Cloudfront by adding the following CORS configuration.

    <?xml version="1.0" encoding="UTF-8"?>
    <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
      <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>Content-*</AllowedHeader>
        <AllowedHeader>Host</AllowedHeader>
      </CORSRule>
    </CORSConfiguration>
    

    http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html

    http://html5hacks.com/blog/2012/11/18/configure-amazon-s3-for-cross-origin-resourse-sharing-to-host-a-web-font/

    http://blog.blenderbox.com/2012/10/12/serving-font-face-fonts-to-firefox-from-an-s3-bucket/

    0 讨论(0)
  • 2021-02-04 05:27

    You may well need to add support for the MIME types on the new hosting environment.

    Take a look at:

    http://www.jbarker.com/blog/2011/web-fonts-mime-types

    0 讨论(0)
提交回复
热议问题