Last Updated: February 25, 2016
·
3.002K
· piermariacosina

Serving Fonts using Rackspace cloud files

If you are not using the API you should get Cyberduck, it allow easy changing of the files Header.

Open Cyberduck create a new container or upload file to an existing one.

Select all the font files and press Cmd+i to get informations of those files.
Navigate to the second tab Metadata and add a new one:
Access-Control-Allow-Origin with value *
Now deselect and select only .svg fonts, again Cmd+i -> metadata change the Content-type to:
image/svg+xml
Do the same process for .eot .otf .woff
eot files: application/vnd.ms-fontobject
otf files: font/opentype
woff files: application/font-woff

Select the font folder, Cmd+i navigate to the third tab Distribution where you should check if the Enable Akamai is checked and you can press Invalidate button in the bottom right, this invalidate the TTL so you are sure that you get the latest modified content (only 25 times a day allowed).

On the General tab you can get the url to the folder so you can change the path in you CSS file.

If font are not correct try to put this in your .htaccess, you can add one in the same folder
<\FilesMatch ".(ttf|otf|eot|woff)$">
<\IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
<\/IfModule>
<\/FilesMatch>

Note: remove the first \ I didn't find how to escape code ...

If is working you can go to your Cloud File panel and change the TTL for the font container or folder to 72hours in this way you will really leverage the CDN cache.