How to disable “Cannot Render Console from…” on Rails

后端 未结 11 1322
心在旅途
心在旅途 2020-12-07 10:35

I\'m using Ubuntu/vagrant as my development environment. I\'m getting these messages on rails console:

Started GET \"/assets/home-fcec5b5a277ac7c20cc9f45a209         


        
11条回答
  •  难免孤独
    2020-12-07 10:53

    If you are using Docker most likely you don't want neither to introduce new ENV variables nor to hardcode your specific IP address.

    Instead you may want to check that you are in Docker using /proc/1/cgroup, and to allow your host IP (both for web_console and better_errors). Add to your config/environments/development.rb

      # https://stackoverflow.com/a/20012536/4862360
      if File.read('/proc/1/cgroup').include?('docker')
        # https://stackoverflow.com/a/24716645/4862360
        host_ip = `/sbin/ip route|awk '/default/ { print $3 }'`.strip
    
        BetterErrors::Middleware.allow_ip!(host_ip) if defined?(BetterErrors::Middleware)
        config.web_console.whitelisted_ips << host_ip
      end
    

提交回复
热议问题