I\'m looking to add custom http headers to a Ruby on Rails app that is currently hosted on Heroku.
In Rails 3 or above, simply
headers['Header-Name'] = 'header value'
works in controllers. This is even the recommended way; according to the documentation,
Response is mostly a Ruby on Rails framework implementation detail, and should never be used directly in controllers. Controllers should use the methods defined in
ActionController::Baseinstead. For example, if you want to set the HTTP response’s content MIME type, then useActionController::Base#headersinstead ofResponse#headers.
And this is still true in Rails 6.0.