Set a custom header using this special rack middleware.
Add this line to your application's Gemfile:
gem 'rack-customheader', git: [email protected]:svevang/rack-customheader.git
And then execute:
$ bundle
E.g you can set CORS headers:
In config/environements/production.rb:
config.middleware.insert_before(ActionDispatch::Static, Rack::CustomHeader, {'Access-Control-Allow-Origin' => '*', 'Access-Control-Allow-Methods' => 'GET, POST'})
Make sure to include this middleware before ActionDispatch::Static
and
serve your static assets using rails.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request