Skip to content
No description or website provided.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
test
Gemfile
LICENSE
Rakefile
rack-access-control-headers.gemspec
readme.md

readme.md

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.

Install

Add this to your applications Gemfile:

gem 'rack-access-control-headers'

And run:

$ bundle

Usage

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.