-
-
Save hernandesbsousa/ed8e3cb9b70e70d97655 to your computer and use it in GitHub Desktop.
CORS setup for Nginx/Apache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For nginx, | |
location ~* \.(eot|ttf|woff)$ { | |
add_header Access-Control-Allow-Origin *; | |
} | |
Or better way inside virtual host location use, | |
Inside location use | |
if ($request_filename ~* ^.?/([^/]?)$) | |
{ | |
set $filename $1; | |
} | |
if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){ | |
add_header Access-Control-Allow-Origin *; | |
} | |
For Apache | |
For apache in apache.conf | |
AddType application/vnd.ms-fontobject .eot | |
AddType font/ttf .ttf | |
AddType font/otf .otf | |
<FilesMatch "\.(ttf|otf|eot)$"> | |
<IfModule mod_headers.c> | |
Header set Access-Control-Allow-Origin "*" | |
</IfModule> | |
</FilesMatch> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment