Upgraded Rails to 6, getting Blocked host Error

后端 未结 6 1595
闹比i
闹比i 2021-02-03 19:41

I needed the new function in ActiveStorage to resize_to_fill so I upgraded to Ruby 2.5.1 and Rails 6.

ruby \'2.5.1\'

gem \"rails\", github: \"rails/rails\"
         


        
6条回答
  •  清酒与你
    2021-02-03 20:21

    This article worked for me:

    1. The first option is to whitelist the hostnames in config/environments/development.rb:

      Rails.application.configure do
        config.hosts << "hostname" # Whitelist one hostname
        config.hosts << /application\.local\Z/ # Whitelist a test domain
      end
      
    2. The second option is to clear the entire whitelist, which lets through requests for all hostnames:

      Rails.application.configure do
        config.hosts.clear
      end
      

    Credit goes to Manfred Stienstra.

提交回复
热议问题