dockerconsoleruby-on-rails-6web-console

In Rails 6, how do I allow deveopment console access from any local machine/network?


I’m running a Rails 6 application from a Docker container. When I start my application, I get errors like this on the log

rails.1      | Cannot render console from 142.29.0.1! Allowed networks: 0.0.0.0, 127.0.0.0/127.255.255.255, ::1

How do I allow connections from any network? I don’t want to hard-code IPs because that won’t scale to other developers machines. I tried adding this in config/environments/development.rb

  config.web_console.permissions = '0.0.0.0/255.255.255.255'

But after restarting my server I get the same error.


Solution

  • I would say that '0.0.0.0/255.255.255.255' is not correct syntax - especially network part after /. Valid CIDR notation should be use there.

    If you want to allow all IPv4 IPs, then correct CIDR notation is:

    config.web_console.permissions = '0.0.0.0/0'
    

    See: AWS: What does 0.0.0.0/0 and ::/0 mean?

    If you want to allow all local IPv4 IPs, then you need to know right CIDR notation of your local network, e.g.192.168.0.0/16:

    config.web_console.permissions = '192.168.0.0/16'
    

    See also rail doc https://github.com/rails/web-console#configweb_consolepermissions