Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Rakefile
Octocat-spinner-32 rack-access-control-headers.gemspec

Access Control Headers

Ever tried to serve custom font files from a cdn or similar? Doesn't work too well in Firefox does it...

This middleware is designed to set the required headers for a cdn to cache, meaning you can leave your nginx conf alone.

Works well on heroku with cloudfront in front.


Add this to your applications Gemfile:

gem 'rack-access-control-headers'

And run:

$ bundle


In config/application.rb (or specific environment file):

config.middleware.insert_before 'ActionDispatch::Static', 'Rack::AccessControlHeaders', /assets/

Where /assets/ is a regex of the path you want to inject the headers.

N.b. including ahead of ActionDispatch::Static is important if you're running rails.

Something went wrong with that request. Please try again.