Skip to content

Instantly share code, notes, and snippets.

@kurap
Created November 19, 2013 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurap/7546782 to your computer and use it in GitHub Desktop.
Save kurap/7546782 to your computer and use it in GitHub Desktop.
クロスドメインでWEBフォントを使用する場合の設定
IE, Firefoxの最新版だとクロスドメイン制約のため、S3からWEBフォントをダウンロードしようとするとエラーとなる。
>> 対処方法
bucket の [properties] - [Permissions] の [add 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>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
NGINXの設定でヘッダー追加をする場合
location ~* \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
source:http://serverfault.com/questions/162429/how-do-i-add-access-control-allow-origin-in-nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment