Install cloudflare-rails
mainAdd the gem to your Gemfile within a specific environment group (like :production, :staging, or :beta) to ensure it is not loaded in :development or :test.
group :production do
gem 'cloudflare-rails'
endThen run bundle to install.
Prerequisite: You must have a cache_store configured in your Rails application for the gem to fetch and cache Cloudflare IP lists.
group :production do
# or :staging or :beta or whatever environments you are using cloudflare in.
# you probably don't want this for :test or :development
gem 'cloudflare-rails'
end