title: Rails: possible to restrict a route based on IP address (or range?)
body: <p>I know this usually happens in the controller but I'm wondering if it's possible in <code>config/routes.rb</code> to restrict a route based on a specific IP (or range of IPs)? Sort of a whitelist, of sorts.</p>
  
  <p>for example I'd like to restrict this route to only IPs on our subnet:</p>
  
  <pre><code>#config/routes.rb
  require 'sidekiq/web'
  
  MyApp::Application.routes.draw do
    resources :users
    ...
    mount Sidekiq::Web, at: "/sidekiq"      # &lt;== restrict this based on IP address
    ...
  end
  </code></pre>